diff --git a/build.gradle.kts b/build.gradle.kts index f7bc95b1d..0864d8a55 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -164,7 +164,7 @@ dependencies { implementation(fg.deobf("curse.maven:farmers_delight-398521:4638874")) implementation(fg.deobf("curse.maven:create-328085:4626108")) - implementation(fg.deobf("curse.maven:jeed-532286:4599236")) + //implementation(fg.deobf("curse.maven:jeed-532286:4599236")) runtimeOnly(fg.deobf("curse.maven:world-stripper-250603:4578579")) runtimeOnly(fg.deobf("curse.maven:spark-361579:4587309")) } diff --git a/gradle.properties b/gradle.properties index 463337bc9..d0687615c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ modJavaVersion=17 minecraftVersion=1.20.1 minecraftVersionRange=[1.20.1,1.21] # Forge Versions -forgeVersion=47.1.0 +forgeVersion=47.2.1 forgeVersionRange=[47,) loaderVersionRange=[47,) diff --git a/src/generated/resources/data/malum/tags/worldgen/biome/has_runewood.json b/src/generated/resources/data/malum/tags/worldgen/biome/has_runewood.json new file mode 100644 index 000000000..d3152c5b0 --- /dev/null +++ b/src/generated/resources/data/malum/tags/worldgen/biome/has_runewood.json @@ -0,0 +1,5 @@ +{ + "values": [ + "#minecraft:is_overworld" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/malum/worldgen/configured_feature/soulwood_tree.json b/src/generated/resources/data/malum/worldgen/configured_feature/soulwood_tree.json index cfc46d45f..e69de29bb 100644 --- a/src/generated/resources/data/malum/worldgen/configured_feature/soulwood_tree.json +++ b/src/generated/resources/data/malum/worldgen/configured_feature/soulwood_tree.json @@ -1,4 +0,0 @@ -{ - "type": "malum:soulwood_tree", - "config": {} -} \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/MalumMod.java b/src/main/java/com/sammy/malum/MalumMod.java index 675dbe7c5..55fcca08c 100644 --- a/src/main/java/com/sammy/malum/MalumMod.java +++ b/src/main/java/com/sammy/malum/MalumMod.java @@ -6,24 +6,26 @@ import com.sammy.malum.config.CommonConfig; import com.sammy.malum.data.MalumBiomeTags; import com.sammy.malum.data.MalumLang; -import com.sammy.malum.data.MalumRecipes; -import com.sammy.malum.data.MalumWorldgenProvider; +import com.sammy.malum.data.RegistryDataGenerator; import com.sammy.malum.data.block.MalumBlockLootTables; import com.sammy.malum.data.block.MalumBlockStates; import com.sammy.malum.data.block.MalumBlockTags; import com.sammy.malum.data.item.MalumItemModels; -import com.sammy.malum.data.item.MalumItemTags; -import com.sammy.malum.data.recipe.*; import com.sammy.malum.registry.common.item.tabs.CreativeTabRegistry; +import net.minecraft.DetectedVersion; import net.minecraft.core.HolderLookup; import net.minecraft.data.DataGenerator; import net.minecraft.data.PackOutput; +import net.minecraft.data.metadata.PackMetadataGenerator; +import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.packs.PackType; +import net.minecraft.server.packs.metadata.pack.PackMetadataSection; import net.minecraft.util.RandomSource; -import net.minecraftforge.common.data.BlockTagsProvider; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; @@ -31,7 +33,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.util.Arrays; import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import java.util.stream.Collectors; import static com.sammy.malum.registry.client.ParticleRegistry.PARTICLES; import static com.sammy.malum.registry.common.AttributeRegistry.ATTRIBUTES; @@ -83,41 +88,9 @@ public MalumMod() { CreateCompat.init(); modBus.addListener(CreativeTabRegistry::populateItemGroups); - modBus.addListener(DataOnly::gatherData); } public static ResourceLocation malumPath(String path) { return new ResourceLocation(MALUM, path); } - - public static class DataOnly { - public static void gatherData(GatherDataEvent event) { - DataGenerator generator = event.getGenerator(); - PackOutput output = generator.getPackOutput(); - CompletableFuture provider = event.getLookupProvider(); - ExistingFileHelper helper = event.getExistingFileHelper(); - - - MalumItemModels itemModelsProvider = new MalumItemModels(output, helper); - MalumBlockTags blockTagsProvider = new MalumBlockTags(output, provider, helper); - - generator.addProvider(event.includeClient(), new MalumBlockStates(output, helper, itemModelsProvider)); - generator.addProvider(event.includeClient(), itemModelsProvider); - generator.addProvider(event.includeClient(), new MalumLang(output)); - - //TODO generator.addProvider(event.includeServer(), blockTagsProvider); - generator.addProvider(event.includeServer(), new MalumBlockLootTables(output)); - //TODO generator.addProvider(event.includeServer(), new MalumItemTags(output, provider, blockTagsProvider.contentsGetter(), helper)); - - generator.addProvider(event.includeServer(), new MalumRecipes(output)); - generator.addProvider(event.includeServer(), new MalumVanillaRecipeReplacements(output)); - generator.addProvider(event.includeServer(), new MalumSpiritInfusionRecipes(output)); - generator.addProvider(event.includeServer(), new MalumSpiritFocusingRecipes(output)); - generator.addProvider(event.includeServer(), new MalumSpiritTransmutationRecipes(output)); - generator.addProvider(event.includeServer(), new MalumVoidFavorRecipes(output)); - - generator.addProvider(event.includeServer(), new MalumWorldgenProvider(output, provider)); - generator.addProvider(event.includeServer(), new MalumBiomeTags(output, provider, helper)); - } - } } \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/data/BiomeModifications.java b/src/main/java/com/sammy/malum/data/BiomeModifications.java new file mode 100644 index 000000000..a4952f94b --- /dev/null +++ b/src/main/java/com/sammy/malum/data/BiomeModifications.java @@ -0,0 +1,62 @@ +package com.sammy.malum.data; + +import com.sammy.malum.MalumMod; +import com.sammy.malum.registry.common.worldgen.BiomeTagRegistry; +import com.sammy.malum.registry.common.worldgen.PlacedFeatureRegistry; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderSet; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.BootstapContext; +import net.minecraft.resources.ResourceKey; +import net.minecraft.tags.TagKey; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; +import net.minecraftforge.common.world.BiomeModifier; +import net.minecraftforge.common.world.ForgeBiomeModifiers; +import net.minecraftforge.registries.ForgeRegistries; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.Supplier; + +public class BiomeModifications { + public static void bootstrap(BootstapContext context) { + register(context, "soulstone_ore", () -> + addFeatureModifier(context, + getPlacedHolderSet(context, PlacedFeatureRegistry.ORE_SOULSTONE), + BiomeTagRegistry.HAS_SOULSTONE, GenerationStep.Decoration.UNDERGROUND_ORES)); + + register(context, "brilliant_ore", () -> + addFeatureModifier(context, + getPlacedHolderSet(context, PlacedFeatureRegistry.ORE_BRILLIANT), + BiomeTagRegistry.HAS_BRILLIANT, GenerationStep.Decoration.UNDERGROUND_ORES)); + + register(context, "natural_quartz_ore", () -> + addFeatureModifier(context, + getPlacedHolderSet(context, PlacedFeatureRegistry.ORE_NATURAL_QUARTZ), + BiomeTagRegistry.HAS_SOULSTONE, GenerationStep.Decoration.UNDERGROUND_ORES)); + + register(context, "runwood_tree", () -> + addFeatureModifier(context, + getPlacedHolderSet(context, PlacedFeatureRegistry.RUNEWOOD_TREE), + BiomeTagRegistry.HAS_RUNEWOOD, GenerationStep.Decoration.VEGETAL_DECORATION)); + + } + + public static HolderSet getPlacedHolderSet(BootstapContext context, ResourceKey... placedFeatures) { + List> holders = new ArrayList<>(); + for (ResourceKey feature : placedFeatures) { + holders.add(context.lookup(Registries.PLACED_FEATURE).getOrThrow(feature)); + } + return HolderSet.direct(holders); + } + + private static ForgeBiomeModifiers.AddFeaturesBiomeModifier addFeatureModifier(BootstapContext context, HolderSet placedSet, TagKey biomeTag, GenerationStep.Decoration decoration) { + return new ForgeBiomeModifiers.AddFeaturesBiomeModifier(context.lookup(Registries.BIOME).getOrThrow(biomeTag), placedSet, decoration); + } + + private static void register(BootstapContext context, String name, Supplier modifier) { + context.register(ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, MalumMod.malumPath(name)), modifier.get()); + } +} diff --git a/src/main/java/com/sammy/malum/data/DataGenerators.java b/src/main/java/com/sammy/malum/data/DataGenerators.java new file mode 100644 index 000000000..bdfac88ac --- /dev/null +++ b/src/main/java/com/sammy/malum/data/DataGenerators.java @@ -0,0 +1,62 @@ +package com.sammy.malum.data; + +import com.sammy.malum.MalumMod; +import com.sammy.malum.data.block.MalumBlockLootTables; +import com.sammy.malum.data.block.MalumBlockStates; +import com.sammy.malum.data.block.MalumBlockTags; +import com.sammy.malum.data.item.MalumItemModels; +import com.sammy.malum.data.recipe.*; +import net.minecraft.DetectedVersion; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.PackOutput; +import net.minecraft.data.metadata.PackMetadataGenerator; +import net.minecraft.network.chat.Component; +import net.minecraft.server.packs.PackType; +import net.minecraft.server.packs.metadata.pack.PackMetadataSection; +import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider; +import net.minecraftforge.common.data.ExistingFileHelper; +import net.minecraftforge.data.event.GatherDataEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; + +import java.util.Arrays; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; +import java.util.stream.Collectors; + +@Mod.EventBusSubscriber(modid = MalumMod.MALUM, bus = Mod.EventBusSubscriber.Bus.MOD) +public class DataGenerators { + + @SubscribeEvent + public static void gatherData(GatherDataEvent event) { + DataGenerator generator = event.getGenerator(); + PackOutput output = generator.getPackOutput(); + CompletableFuture provider = event.getLookupProvider(); + ExistingFileHelper helper = event.getExistingFileHelper(); + + + MalumItemModels itemModelsProvider = new MalumItemModels(output, helper); + MalumBlockTags blockTagsProvider = new MalumBlockTags(output, provider, helper); + + generator.addProvider(event.includeClient(), new MalumBlockStates(output, helper, itemModelsProvider)); + generator.addProvider(event.includeClient(), itemModelsProvider); + + + //TODO generator.addProvider(event.includeServer(), blockTagsProvider); + generator.addProvider(event.includeServer(), new MalumBlockLootTables(output)); + //TODO generator.addProvider(event.includeServer(), new MalumItemTags(output, provider, blockTagsProvider.contentsGetter(), helper)); + + generator.addProvider(event.includeServer(), new MalumRecipes(output)); + generator.addProvider(event.includeServer(), new MalumVanillaRecipeReplacements(output)); + generator.addProvider(event.includeServer(), new MalumSpiritInfusionRecipes(output)); + generator.addProvider(event.includeServer(), new MalumSpiritFocusingRecipes(output)); + generator.addProvider(event.includeServer(), new MalumSpiritTransmutationRecipes(output)); + generator.addProvider(event.includeServer(), new MalumVoidFavorRecipes(output)); + + generator.addProvider(event.includeServer(), new MalumBiomeTags(output, provider, helper)); + + generator.addProvider(event.includeServer(), new RegistryDataGenerator(output, provider)); + generator.addProvider(event.includeClient(), new MalumLang(output)); + } +} diff --git a/src/main/java/com/sammy/malum/data/MalumWorldgenProvider.java b/src/main/java/com/sammy/malum/data/MalumWorldgenProvider.java deleted file mode 100644 index f4e980849..000000000 --- a/src/main/java/com/sammy/malum/data/MalumWorldgenProvider.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.sammy.malum.data; - -import com.sammy.malum.MalumMod; -import com.sammy.malum.registry.common.worldgen.BiomeTagRegistry; -import com.sammy.malum.registry.common.worldgen.ConfiguredFeatureRegistry; -import com.sammy.malum.registry.common.worldgen.FeatureRegistry; -import com.sammy.malum.registry.common.worldgen.PlacedFeatureRegistry; -import net.minecraft.core.Holder; -import net.minecraft.core.HolderLookup; -import net.minecraft.core.HolderSet; -import net.minecraft.core.RegistrySetBuilder; -import net.minecraft.core.registries.Registries; -import net.minecraft.data.PackOutput; -import net.minecraft.data.worldgen.BootstapContext; -import net.minecraft.resources.ResourceKey; -import net.minecraft.tags.TagKey; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.levelgen.GenerationStep; -import net.minecraft.world.level.levelgen.placement.PlacedFeature; -import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider; -import net.minecraftforge.common.world.BiomeModifier; -import net.minecraftforge.common.world.ForgeBiomeModifiers; -import net.minecraftforge.registries.ForgeRegistries; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.function.Supplier; - -public class MalumWorldgenProvider extends DatapackBuiltinEntriesProvider { - - public MalumWorldgenProvider(PackOutput output, CompletableFuture registries) { - super(output, registries, BUILDER, Set.of(MalumMod.MALUM)); - } - - private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder() - .add(Registries.CONFIGURED_FEATURE, ConfiguredFeatureRegistry::bootstrap) - .add(Registries.PLACED_FEATURE, PlacedFeatureRegistry::bootstrap) - .add(ForgeRegistries.Keys.BIOME_MODIFIERS, BiomeModification::bootstrap); - - private static class BiomeModification { - public static void bootstrap(BootstapContext context) { - register(context, "soulstone_ore", () -> - addFeatureModifier(context, - getPlacedHolderSet(context, PlacedFeatureRegistry.ORE_SOULSTONE), - BiomeTagRegistry.HAS_SOULSTONE, GenerationStep.Decoration.UNDERGROUND_ORES)); - - register(context, "brilliant_ore", () -> - addFeatureModifier(context, - getPlacedHolderSet(context, PlacedFeatureRegistry.ORE_BRILLIANT), - BiomeTagRegistry.HAS_BRILLIANT, GenerationStep.Decoration.UNDERGROUND_ORES)); - - register(context, "natural_quartz_ore", () -> - addFeatureModifier(context, - getPlacedHolderSet(context, PlacedFeatureRegistry.ORE_NATURAL_QUARTZ), - BiomeTagRegistry.HAS_SOULSTONE, GenerationStep.Decoration.UNDERGROUND_ORES)); - - register(context, "runwood_tree", () -> - addFeatureModifier(context, - getPlacedHolderSet(context, PlacedFeatureRegistry.RUNEWOOD_TREE), - BiomeTagRegistry.HAS_RUNEWOOD, GenerationStep.Decoration.VEGETAL_DECORATION)); - - } - - public static HolderSet getPlacedHolderSet(BootstapContext context, ResourceKey... placedFeatures) { - List> holders = new ArrayList<>(); - for (ResourceKey feature : placedFeatures) { - holders.add(context.lookup(Registries.PLACED_FEATURE).getOrThrow(feature)); - } - return HolderSet.direct(holders); - } - - private static ForgeBiomeModifiers.AddFeaturesBiomeModifier addFeatureModifier(BootstapContext context, HolderSet placedSet, TagKey biomeTag, GenerationStep.Decoration decoration) { - return new ForgeBiomeModifiers.AddFeaturesBiomeModifier(context.lookup(Registries.BIOME).getOrThrow(biomeTag), placedSet, decoration); - } - - private static void register(BootstapContext context, String name, Supplier modifier) { - context.register(ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, MalumMod.malumPath(name)), modifier.get()); - } - } -} diff --git a/src/main/java/com/sammy/malum/data/RegistryDataGenerator.java b/src/main/java/com/sammy/malum/data/RegistryDataGenerator.java new file mode 100644 index 000000000..d20c03302 --- /dev/null +++ b/src/main/java/com/sammy/malum/data/RegistryDataGenerator.java @@ -0,0 +1,41 @@ +package com.sammy.malum.data; + +import com.sammy.malum.MalumMod; +import com.sammy.malum.registry.common.worldgen.BiomeTagRegistry; +import com.sammy.malum.registry.common.worldgen.ConfiguredFeatureRegistry; +import com.sammy.malum.registry.common.worldgen.PlacedFeatureRegistry; +import com.sammy.malum.registry.common.worldgen.StructureRegistry; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.HolderSet; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.data.worldgen.BootstapContext; +import net.minecraft.resources.ResourceKey; +import net.minecraft.tags.TagKey; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.levelgen.GenerationStep; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; +import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider; +import net.minecraftforge.common.world.BiomeModifier; +import net.minecraftforge.common.world.ForgeBiomeModifiers; +import net.minecraftforge.registries.ForgeRegistries; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; + +public class RegistryDataGenerator extends DatapackBuiltinEntriesProvider { + + private static final RegistrySetBuilder BUILDER = new RegistrySetBuilder() + .add(Registries.CONFIGURED_FEATURE, ConfiguredFeatureRegistry::bootstrap) + .add(Registries.PLACED_FEATURE, PlacedFeatureRegistry::bootstrap) + .add(ForgeRegistries.Keys.BIOME_MODIFIERS, BiomeModifications::bootstrap); + + public RegistryDataGenerator(PackOutput output, CompletableFuture registries) { + super(output, registries, BUILDER, Set.of("minecraft", MalumMod.MALUM)); + } +} diff --git a/src/main/java/com/sammy/malum/registry/common/worldgen/ConfiguredFeatureRegistry.java b/src/main/java/com/sammy/malum/registry/common/worldgen/ConfiguredFeatureRegistry.java index d4b33241c..b6277d74a 100644 --- a/src/main/java/com/sammy/malum/registry/common/worldgen/ConfiguredFeatureRegistry.java +++ b/src/main/java/com/sammy/malum/registry/common/worldgen/ConfiguredFeatureRegistry.java @@ -47,15 +47,12 @@ public class ConfiguredFeatureRegistry { OreConfiguration.target(DEEPSLATE_ORE_REPLACEABLES, BlockRegistry.DEEPSLATE_QUARTZ_ORE.get().defaultBlockState())); public static void bootstrap(BootstapContext> context) { - HolderGetter> features = context.lookup(Registries.CONFIGURED_FEATURE); - - context.register(ConfiguredFeatureRegistry.CONFIGURED_SOULSTONE_ORE, addOreConfig(SOULSTONE_TARGET_LIST, 30)); context.register(ConfiguredFeatureRegistry.CONFIGURED_BRILLIANT_ORE, addOreConfig(BRILLIANT_TARGET_LIST, 30)); context.register(ConfiguredFeatureRegistry.CONFIGURED_NATURAL_QUARTZ_ORE, addOreConfig(NATURAL_QUARTZ_TARGET_LIST, 30)); context.register(ConfiguredFeatureRegistry.CONFIGURED_RUNEWOOD_TREE, addTreeConfig(FeatureRegistry.RUNEWOOD_TREE.get())); - //register(context, ConfiguredFeatureRegistry.CONFIGURED_SOULWOOD_TREE, () -> addTreeConfig(FeatureRegistry.SOULWOOD_TREE.get())); + context.register(ConfiguredFeatureRegistry.CONFIGURED_SOULWOOD_TREE, addTreeConfig(FeatureRegistry.SOULWOOD_TREE.get())); } private static ConfiguredFeature addTreeConfig(Feature feature) { diff --git a/src/main/java/com/sammy/malum/registry/common/worldgen/FeatureRegistry.java b/src/main/java/com/sammy/malum/registry/common/worldgen/FeatureRegistry.java index 3d288e81b..c8bae30c5 100644 --- a/src/main/java/com/sammy/malum/registry/common/worldgen/FeatureRegistry.java +++ b/src/main/java/com/sammy/malum/registry/common/worldgen/FeatureRegistry.java @@ -45,77 +45,5 @@ public class FeatureRegistry { public static final RegistryObject WEEPING_WELL = FEATURE_TYPES.register("weeping_well", WeepingWellFeature::new); public static final RegistryObject RUNEWOOD_TREE = FEATURE_TYPES.register("runewood_tree", RunewoodTreeFeature::new); public static final RegistryObject SOULWOOD_TREE = FEATURE_TYPES.register("soulwood_tree", SoulwoodTreeFeature::new); - public static final RegistryObject CTHONIC_GOLD_GEODE = FEATURE_TYPES.register("cthonic_gold_geode", () -> new RareEarthsGeode(GeodeConfiguration.CODEC)); -/* - public static final class ConfiguredFeatures { - public static final Holder> RUNEWOOD_TREE_FEATURE = FeatureUtils.register("runewood_tree", FeatureRegistry.RUNEWOOD_TREE.get(), INSTANCE); - - public static final Holder> WEEPING_WELL_FEATURE = FeatureUtils.register("weeping_well", FeatureRegistry.WEEPING_WELL.get(), INSTANCE); - - public static final Holder> BLAZING_QUARTZ_FEATURE = FeatureUtils.register("blazing_quartz", Feature.ORE, - new OreConfiguration(OreFeatures.NETHERRACK, BlockRegistry.BLAZING_QUARTZ_ORE.get().defaultBlockState(), CommonConfig.BLAZE_QUARTZ_SIZE.getConfigValue())); - - public static final List BRILLIANCE_TARGET_LIST = List.of(OreConfiguration.target(STONE_ORE_REPLACEABLES, BlockRegistry.BRILLIANT_STONE.get().defaultBlockState()), OreConfiguration.target(DEEPSLATE_ORE_REPLACEABLES, BlockRegistry.BRILLIANT_DEEPSLATE.get().defaultBlockState())); - public static final Holder> BRILLIANCE_FEATURE = FeatureUtils.register("brilliance", Feature.ORE, - new OreConfiguration(BRILLIANCE_TARGET_LIST, CommonConfig.BRILLIANT_STONE_SIZE.getConfigValue())); - - public static final List SOULSTONE_TARGET_LIST = List.of(OreConfiguration.target(STONE_ORE_REPLACEABLES, BlockRegistry.SOULSTONE_ORE.get().defaultBlockState()), OreConfiguration.target(DEEPSLATE_ORE_REPLACEABLES, BlockRegistry.DEEPSLATE_SOULSTONE_ORE.get().defaultBlockState())); - public static final Holder> SOULSTONE_FEATURE = FeatureUtils.register("soulstone_ore", Feature.ORE, - new OreConfiguration(SOULSTONE_TARGET_LIST, CommonConfig.SOULSTONE_SIZE.getConfigValue())); - - public static final Holder> SURFACE_SOULSTONE_FEATURE = FeatureUtils.register("surface_soulstone_ore", Feature.ORE, - new OreConfiguration(SOULSTONE_TARGET_LIST, CommonConfig.SURFACE_SOULSTONE_SIZE.getConfigValue())); - - - public static final List NATURAL_QUARTZ_TARGET_LIST = List.of(OreConfiguration.target(STONE_ORE_REPLACEABLES, BlockRegistry.NATURAL_QUARTZ_ORE.get().defaultBlockState()), OreConfiguration.target(DEEPSLATE_ORE_REPLACEABLES, BlockRegistry.DEEPSLATE_QUARTZ_ORE.get().defaultBlockState())); - public static final Holder> NATURAL_QUARTZ_FEATURE = FeatureUtils.register("natural_quartz", Feature.ORE, - new OreConfiguration(NATURAL_QUARTZ_TARGET_LIST, CommonConfig.NATURAL_QUARTZ_SIZE.getConfigValue())); - - public static final Holder> QUARTZ_GEODE_FEATURE = FeatureUtils.register("quartz_geode", Feature.GEODE, new GeodeConfiguration(new GeodeBlockSettings(BlockStateProvider.simple(Blocks.AIR), BlockStateProvider.simple(BlockRegistry.NATURAL_QUARTZ_ORE.get()), BlockStateProvider.simple(BlockRegistry.NATURAL_QUARTZ_ORE.get()), BlockStateProvider.simple(Blocks.TUFF), BlockStateProvider.simple(Blocks.SMOOTH_BASALT), List.of(BlockRegistry.NATURAL_QUARTZ_CLUSTER.get().defaultBlockState()), BlockTags.FEATURES_CANNOT_REPLACE, BlockTags.GEODE_INVALID_BLOCKS), new GeodeLayerSettings(1D, 1.2D, 2.2D, 2.8D), new GeodeCrackSettings(1f, 4.0D, 3), 0.85D, 0.2D, true, UniformInt.of(3, 5), UniformInt.of(2, 3), UniformInt.of(0, 1), -16, 16, 0.1D, 1)); - public static final Holder> DEEPSLATE_QUARTZ_GEODE_FEATURE = FeatureUtils.register("deepslate_quartz_geode", Feature.GEODE, new GeodeConfiguration(new GeodeBlockSettings(BlockStateProvider.simple(Blocks.AIR), BlockStateProvider.simple(BlockRegistry.DEEPSLATE_QUARTZ_ORE.get()), BlockStateProvider.simple(BlockRegistry.DEEPSLATE_QUARTZ_ORE.get()), BlockStateProvider.simple(Blocks.CALCITE), BlockStateProvider.simple(Blocks.SMOOTH_BASALT), List.of(BlockRegistry.NATURAL_QUARTZ_CLUSTER.get().defaultBlockState()), BlockTags.FEATURES_CANNOT_REPLACE, BlockTags.GEODE_INVALID_BLOCKS), new GeodeLayerSettings(1D, 1.4D, 2.6D, 4.2D), new GeodeCrackSettings(1f, 4.0D, 3), 0.85D, 0.2D, true, UniformInt.of(3, 5), UniformInt.of(2, 3), UniformInt.of(0, 1), -16, 16, 0.1D, 1)); - - public static final Holder> CTHONIC_GOLD_GEODE_FEATURE = FeatureUtils.register("cthonic_gold_geode", CTHONIC_GOLD_GEODE.get(), new GeodeConfiguration(new GeodeBlockSettings(BlockStateProvider.simple(Blocks.RAW_GOLD_BLOCK), BlockStateProvider.simple(Blocks.DEEPSLATE_GOLD_ORE), BlockStateProvider.simple(Blocks.RAW_GOLD_BLOCK), BlockStateProvider.simple(Blocks.CALCITE), BlockStateProvider.simple(Blocks.SMOOTH_BASALT), List.of(Blocks.DEEPSLATE_GOLD_ORE.defaultBlockState()), BlockTags.FEATURES_CANNOT_REPLACE, BlockTags.GEODE_INVALID_BLOCKS), new GeodeLayerSettings(0.02D, 0.2D, 0.6D, 1.4D), new GeodeCrackSettings(0.6f, 2.0D, 3), 0.85D, 0.2D, true, UniformInt.of(3, 5), UniformInt.of(2, 3), UniformInt.of(0, 1), -16, 16, 0.1D, 1)); - } - - public static final class PlacedFeatures { - public static final Holder RUNEWOOD_TREE = PlacementUtils.register("common_runewood", ConfiguredFeatures.RUNEWOOD_TREE_FEATURE, - InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, new ChancePlacementFilter(CommonConfig.COMMON_RUNEWOOD_CHANCE.getConfigValue().floatValue()), CountPlacement.of(3)); - public static final Holder RARE_RUNEWOOD_TREE = PlacementUtils.register("rare_runewood", ConfiguredFeatures.RUNEWOOD_TREE_FEATURE, - InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP, new ChancePlacementFilter(CommonConfig.RARE_RUNEWOOD_CHANCE.getConfigValue().floatValue()), CountPlacement.of(3)); - - public static final Holder WEEPING_WELL_FEATURE = PlacementUtils.register("weeping_well", ConfiguredFeatures.WEEPING_WELL_FEATURE, - RarityFilter.onAverageOnceEvery(2), InSquarePlacement.spread(), HeightRangePlacement.of(ConstantHeight.of(VerticalAnchor.absolute(0))), BiomeFilter.biome(), DimensionPlacementFilter.of(DimensionPlacementFilter.fromStrings(CommonConfig.WEEPING_WELL_ALLOWED_DIMENSIONS.getConfigValue()))); - - public static final Holder BLAZING_QUARTZ_FEATURE = PlacementUtils.register("blazing_quartz_ore", ConfiguredFeatures.BLAZING_QUARTZ_FEATURE, - CountPlacement.of(CommonConfig.BLAZE_QUARTZ_AMOUNT.getConfigValue()), InSquarePlacement.spread(), PlacementUtils.RANGE_8_8); - - public static final Holder BRILLIANCE_FEATURE = PlacementUtils.register("brilliant_stone", ConfiguredFeatures.BRILLIANCE_FEATURE, - CountPlacement.of(CommonConfig.BRILLIANT_STONE_AMOUNT.getConfigValue()), InSquarePlacement.spread(), HeightRangePlacement.uniform(VerticalAnchor.absolute(CommonConfig.BRILLIANT_STONE_MIN_Y.getConfigValue()), VerticalAnchor.absolute(CommonConfig.BRILLIANT_STONE_MAX_Y.getConfigValue()))); - - public static final Holder SOULSTONE_FEATURE = PlacementUtils.register("soulstone", ConfiguredFeatures.SOULSTONE_FEATURE, - CountPlacement.of(CommonConfig.SOULSTONE_AMOUNT.getConfigValue()), InSquarePlacement.spread(), HeightRangePlacement.uniform(VerticalAnchor.absolute(CommonConfig.SOULSTONE_MIN_Y.getConfigValue()), VerticalAnchor.absolute(CommonConfig.SOULSTONE_MAX_Y.getConfigValue()))); - - public static final Holder SURFACE_SOULSTONE_FEATURE = PlacementUtils.register("surface_soulstone", ConfiguredFeatures.SURFACE_SOULSTONE_FEATURE, - CountPlacement.of(CommonConfig.SURFACE_SOULSTONE_AMOUNT.getConfigValue()), InSquarePlacement.spread(), HeightRangePlacement.uniform(VerticalAnchor.absolute(CommonConfig.SURFACE_SOULSTONE_MIN_Y.getConfigValue()), VerticalAnchor.absolute(CommonConfig.SURFACE_SOULSTONE_MAX_Y.getConfigValue()))); - - public static final Holder NATURAL_QUARTZ_FEATURE = PlacementUtils.register("natural_quartz", ConfiguredFeatures.NATURAL_QUARTZ_FEATURE, - CountPlacement.of(CommonConfig.NATURAL_QUARTZ_AMOUNT.getConfigValue()), InSquarePlacement.spread(), HeightRangePlacement.uniform(VerticalAnchor.absolute(CommonConfig.NATURAL_QUARTZ_MIN_Y.getConfigValue()), VerticalAnchor.absolute(CommonConfig.NATURAL_QUARTZ_MAX_Y.getConfigValue()))); - - public static final Holder QUARTZ_GEODE_FEATURE = PlacementUtils.register("quartz_geode", ConfiguredFeatures.QUARTZ_GEODE_FEATURE, - RarityFilter.onAverageOnceEvery(48), InSquarePlacement.spread(), HeightRangePlacement.uniform(VerticalAnchor.absolute(0), VerticalAnchor.absolute(48)), BiomeFilter.biome(), DimensionPlacementFilter.of(DimensionPlacementFilter.fromStrings(CommonConfig.QUARTZ_GEODE_ALLOWED_DIMENSIONS.getConfigValue()))); - - public static final Holder DEEPSLATE_QUARTZ_GEODE_FEATURE = PlacementUtils.register("deepslate_quartz_geode", ConfiguredFeatures.DEEPSLATE_QUARTZ_GEODE_FEATURE, - RarityFilter.onAverageOnceEvery(24), InSquarePlacement.spread(), HeightRangePlacement.uniform(VerticalAnchor.aboveBottom(6), VerticalAnchor.absolute(-10)), BiomeFilter.biome(), DimensionPlacementFilter.of(DimensionPlacementFilter.fromStrings(CommonConfig.QUARTZ_GEODE_ALLOWED_DIMENSIONS.getConfigValue()))); - - public static final Holder CTHONIC_GOLD_GEODE_FEATURE = PlacementUtils.register("rare_earth_geode", ConfiguredFeatures.CTHONIC_GOLD_GEODE_FEATURE, - RarityFilter.onAverageOnceEvery(30), InSquarePlacement.spread(), HeightRangePlacement.uniform(VerticalAnchor.aboveBottom(6), VerticalAnchor.aboveBottom(40)), BiomeFilter.biome(), DimensionPlacementFilter.of(DimensionPlacementFilter.fromStrings(CommonConfig.CTHONIC_GOLD_ALLOWED_DIMENSIONS.getConfigValue()))); - - - - - } - - - */ } \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/registry/common/worldgen/PlacedFeatureRegistry.java b/src/main/java/com/sammy/malum/registry/common/worldgen/PlacedFeatureRegistry.java index d9a3413d5..6db51c88c 100644 --- a/src/main/java/com/sammy/malum/registry/common/worldgen/PlacedFeatureRegistry.java +++ b/src/main/java/com/sammy/malum/registry/common/worldgen/PlacedFeatureRegistry.java @@ -21,17 +21,8 @@ public class PlacedFeatureRegistry { public static final ResourceKey ORE_BRILLIANT = ResourceKey.create(Registries.PLACED_FEATURE, MalumMod.malumPath("ore_brilliant")); public static final ResourceKey ORE_NATURAL_QUARTZ = ResourceKey.create(Registries.PLACED_FEATURE, MalumMod.malumPath("ore_natural_quartz")); - //TODO public static final ResourceKey ORE_BLAZING_QUARTZ = ResourceKey.create(Registries.PLACED_FEATURE, MalumMod.malumPath("ore_blazing_quartz")); - /*TODO - public static final ResourceKey GEODE_NATURAL_QUARTZ_UPPER = ResourceKey.create(Registries.PLACED_FEATURE, MalumMod.malumPath("geode_quartz_upper")); - public static final ResourceKey GEODE_NATURAL_QUARTZ_LOWER = ResourceKey.create(Registries.PLACED_FEATURE, MalumMod.malumPath("geode_quartz_lower")); - - public static final ResourceKey GEODE_CTHONIC_GOLD_FEATURE = ResourceKey.create(Registries.PLACED_FEATURE, MalumMod.malumPath("geode_rare_earth")); - - */ public static final ResourceKey RUNEWOOD_TREE = ResourceKey.create(Registries.PLACED_FEATURE, MalumMod.malumPath("runewood_tree")); - public static final ResourceKey RARE_RUNEWOOD_TREE = ResourceKey.create(Registries.PLACED_FEATURE, MalumMod.malumPath("rare_runewood_tree")); public static void bootstrap(BootstapContext context) {//TODO fix all parameters HolderGetter> features = context.lookup(Registries.CONFIGURED_FEATURE); @@ -39,10 +30,6 @@ public static void bootstrap(BootstapContext context) {//TODO fix context.register(ORE_SOULSTONE, addOreFeature(features.getOrThrow(ConfiguredFeatureRegistry.CONFIGURED_SOULSTONE_ORE), -16, 112, 16)); context.register(ORE_BRILLIANT, addOreFeature(features.getOrThrow(ConfiguredFeatureRegistry.CONFIGURED_BRILLIANT_ORE), -16, 112, 16)); context.register(ORE_NATURAL_QUARTZ, addOreFeature(features.getOrThrow(ConfiguredFeatureRegistry.CONFIGURED_NATURAL_QUARTZ_ORE), -16, 112, 16)); - - - //register(context, PlacedFeatureRegistry.RARE_RUNEWOOD_TREE, addTreeFeature(context.lookup(Registries.CONFIGURED_FEATURE).get(ConfiguredFeatureRegistry.CONFIGURED_RUNEWOOD_TREE).orElseThrow(), 3, 0.01f)); - } private static PlacedFeature addOreFeature(Holder> configureFeature, int minHeight, int maxHeight, int count) { diff --git a/src/main/java/com/sammy/malum/registry/common/worldgen/StructureRegistry.java b/src/main/java/com/sammy/malum/registry/common/worldgen/StructureRegistry.java index 748446fdf..31a64dff0 100644 --- a/src/main/java/com/sammy/malum/registry/common/worldgen/StructureRegistry.java +++ b/src/main/java/com/sammy/malum/registry/common/worldgen/StructureRegistry.java @@ -1,11 +1,8 @@ package com.sammy.malum.registry.common.worldgen; -import com.mojang.serialization.Codec; import com.sammy.malum.MalumMod; import com.sammy.malum.common.worldgen.WeepingWellStructure; -import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; -import net.minecraft.world.level.levelgen.structure.Structure; import net.minecraft.world.level.levelgen.structure.StructureType; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.RegistryObject; @@ -13,9 +10,6 @@ public class StructureRegistry { public static final DeferredRegister> STRUCTURES = DeferredRegister.create(Registries.STRUCTURE_TYPE, MalumMod.MALUM); - public static final RegistryObject> WEEPING_WELL = STRUCTURES.register("weeping_well", () -> explicitStructureTypeTyping(WeepingWellStructure.CODEC)); + public static final RegistryObject> WEEPING_WELL = STRUCTURES.register("weeping_well", () -> () ->(WeepingWellStructure.CODEC)); - private static StructureType explicitStructureTypeTyping(Codec structureCodec) { - return () -> structureCodec; - } } diff --git a/src/main/resources/data/malum/worldgen/structure/weeping_well.json b/src/main/resources/data/malum/worldgen/structure/weeping_well.json deleted file mode 100644 index 8f2c0fd52..000000000 --- a/src/main/resources/data/malum/worldgen/structure/weeping_well.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "type": "malum:weeping_well", - "start_pool": "malum:weeping_well", - "size": 1, - "max_distance_from_center": 10, - "biomes": "#malum:has_structure/weeping_well_biomes", - "step": "underground_structures", - "max_y": -10, - "min_y": -50, - "offset_in_ground": -4, - "use_expansion_hack": false, - "spawn_overrides": { - "monster": { - "bounding_box": "full", - "spawns": [] - }, - "creature": { - "bounding_box": "full", - "spawns": [] - } - } -} \ No newline at end of file diff --git a/src/main/resources/data/malum/worldgen/structure_set/weeping_well.json b/src/main/resources/data/malum/worldgen/structure_set/weeping_well.json deleted file mode 100644 index 9a2137645..000000000 --- a/src/main/resources/data/malum/worldgen/structure_set/weeping_well.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "structures": [ - { - "structure": "malum:weeping_well", - "weight": 1 - } - ], - "placement": { - "type": "minecraft:random_spread", - "salt": 4206969, - "spacing": 12, - "separation": 8 - } -} \ No newline at end of file diff --git a/src/main/resources/data/malum/worldgen/template_pool/weeping_well.json b/src/main/resources/data/malum/worldgen/template_pool/weeping_well.json deleted file mode 100644 index 2f6eea1d9..000000000 --- a/src/main/resources/data/malum/worldgen/template_pool/weeping_well.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "fallback": "minecraft:empty", - "elements": [ - { - "weight": 1, - "element": { - "location": "malum:weeping_well", - "processors": "minecraft:empty", - "projection": "rigid", - "element_type": "minecraft:single_pool_element" - } - } - ] -} \ No newline at end of file