From 40445462f1e4dad3c435245e4dc09e1e8d078c2b Mon Sep 17 00:00:00 2001 From: temp1011 <34900092+temp1011@users.noreply.github.com> Date: Sun, 14 Jan 2018 20:16:36 +0000 Subject: [PATCH] Add more Dimension Config Blacklists for world generation (#1942) --- .../arboriculture/worldgen/TreeDecorator.java | 3 +++ src/main/java/forestry/core/config/Config.java | 13 +++++++++++-- .../java/forestry/core/worldgen/WorldGenerator.java | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/forestry/arboriculture/worldgen/TreeDecorator.java b/src/main/java/forestry/arboriculture/worldgen/TreeDecorator.java index afd21c5fe..ac9c94834 100644 --- a/src/main/java/forestry/arboriculture/worldgen/TreeDecorator.java +++ b/src/main/java/forestry/arboriculture/worldgen/TreeDecorator.java @@ -40,6 +40,7 @@ import forestry.api.arboriculture.TreeManager; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IAllele; import forestry.arboriculture.commands.TreeGenHelper; +import forestry.core.config.Config; import forestry.core.utils.BlockUtil; public class TreeDecorator { @@ -54,6 +55,8 @@ public class TreeDecorator { } public static void decorateTrees(World world, Random rand, int worldX, int worldZ) { + if(Config.blacklistedTreeDims.contains(world.provider.getDimension())) + return; if (biomeCache.isEmpty()) { generateBiomeCache(world, rand); } diff --git a/src/main/java/forestry/core/config/Config.java b/src/main/java/forestry/core/config/Config.java index 970418c5a..85e0db4b3 100755 --- a/src/main/java/forestry/core/config/Config.java +++ b/src/main/java/forestry/core/config/Config.java @@ -79,11 +79,13 @@ public class Config { public static boolean generateApatiteOre = true; public static boolean generateCopperOre = true; public static boolean generateTinOre = true; + public static Set blacklistedOreDims = new HashSet(); private static float generateBeehivesAmount = 1.0f; public static boolean generateBeehivesDebug = false; public static boolean logHivePlacement = false; public static boolean enableVillagers = true; public static boolean generateTrees = true; + public static Set blacklistedTreeDims = new HashSet(); // Retrogen public static boolean doRetrogen = false; @@ -219,11 +221,18 @@ public class Config { generateApatiteOre = configCommon.getBooleanLocalized("world.generate.ore", "apatite", generateApatiteOre); generateCopperOre = configCommon.getBooleanLocalized("world.generate.ore", "copper", generateCopperOre); generateTinOre = configCommon.getBooleanLocalized("world.generate.ore", "tin", generateTinOre); - + for(int dimId : configCommon.get("world.generate.ore", "dimBlacklist", new int[0]).getIntList()){ + blacklistedOreDims.add(dimId); + } + enableVillagers = configCommon.getBooleanLocalized("world.generate", "villagers", enableVillagers); generateTrees = configCommon.getBooleanLocalized("world.generate", "trees", generateTrees); - + for(int dimId : configCommon.get("world.generate.trees", "dimBlacklist", new int[0]).getIntList()){ + blacklistedTreeDims.add(dimId); + } + + craftingBronzeEnabled = configCommon.getBooleanLocalized("crafting", "bronze", craftingBronzeEnabled); craftingStampsEnabled = configCommon.getBooleanLocalized("crafting.stamps", "enabled", true); diff --git a/src/main/java/forestry/core/worldgen/WorldGenerator.java b/src/main/java/forestry/core/worldgen/WorldGenerator.java index 3abe425de..5a2280454 100755 --- a/src/main/java/forestry/core/worldgen/WorldGenerator.java +++ b/src/main/java/forestry/core/worldgen/WorldGenerator.java @@ -68,6 +68,8 @@ public class WorldGenerator implements IWorldGenerator { } private void generateWorld(Random random, int chunkX, int chunkZ, World world) { + if(Config.blacklistedOreDims.contains(world.provider.getDimension())) + return; if (apatiteGenerator == null || copperGenerator == null || tinGenerator == null) { BlockResourceOre resourcesBlock = ModuleCore.getBlocks().resources;