diff --git a/src/main/java/techreborn/config/TechRebornConfig.java b/src/main/java/techreborn/config/TechRebornConfig.java index ac8117825..4180f4346 100644 --- a/src/main/java/techreborn/config/TechRebornConfig.java +++ b/src/main/java/techreborn/config/TechRebornConfig.java @@ -604,4 +604,10 @@ public class TechRebornConfig { @Config(config = "world", category = "loot", key = "enableEndLoot", comment = "When true TechReborn will add ingots, machine frames and circuits to The End loot chests.") public static boolean enableEndLoot = true; + + @Config(config = "world", category = "generation", key = "enableOreGeneration", comment = "When enabled ores will generate in the world") + public static boolean enableOreGeneration = true; + + @Config(config = "world", category = "generation", key = "enableRubberTreeGeneration", comment = "When enabled rubber trees will generate in the world") + public static boolean enableRubberTreeGeneration = true; } diff --git a/src/main/java/techreborn/world/WorldGenerator.java b/src/main/java/techreborn/world/WorldGenerator.java index a3d4cd232..a5f8895bd 100644 --- a/src/main/java/techreborn/world/WorldGenerator.java +++ b/src/main/java/techreborn/world/WorldGenerator.java @@ -45,6 +45,7 @@ import net.minecraft.world.gen.stateprovider.BlockStateProvider; import net.minecraft.world.gen.stateprovider.WeightedBlockStateProvider; import net.minecraft.world.gen.trunk.StraightTrunkPlacer; import techreborn.blocks.misc.BlockRubberLog; +import techreborn.config.TechRebornConfig; import techreborn.init.TRContent; import java.util.Arrays; @@ -64,6 +65,10 @@ public class WorldGenerator { public static void initWorldGen() { registerTreeDecorators(); + if (!TechRebornConfig.enableOreGeneration && !TechRebornConfig.enableOreGeneration) { + return; + } + BiomeModifications.create(new Identifier("techreborn", "features")) .add(ModificationPhase.ADDITIONS, BiomeSelectors.all(), oreModifier()) .add(ModificationPhase.ADDITIONS, BiomeSelectors.categories(Biome.Category.FOREST, Biome.Category.TAIGA, Biome.Category.SWAMP), rubberTreeModifier()); @@ -71,6 +76,10 @@ public class WorldGenerator { private static BiConsumer oreModifier() { return (biomeSelectionContext, biomeModificationContext) -> { + if (!TechRebornConfig.enableOreGeneration) { + return; + } + for (OreFeature feature : ORE_FEATURES) { if (feature.getBiomeSelector().test(biomeSelectionContext)) { biomeModificationContext.getGenerationSettings().addFeature(GenerationStep.Feature.UNDERGROUND_ORES, feature.getPlacedFeatureRegistryKey()); @@ -114,6 +123,10 @@ public class WorldGenerator { } private static BiConsumer rubberTreeModifier() { + if (!TechRebornConfig.enableRubberTreeGeneration) { + return (biomeSelectionContext, biomeModificationContext) -> {}; + } + final RegistryKey registryKey = BuiltinRegistries.PLACED_FEATURE.getKey(RUBBER_TREE_PATCH_PLACED_FEATURE).orElseThrow(); return (biomeSelectionContext, biomeModificationContext) ->