diff --git a/src/main/java/biomesoplenty/api/BOPBiomeManager.java b/src/main/java/biomesoplenty/api/BOPBiomeManager.java index fb7868857..c94fdd563 100644 --- a/src/main/java/biomesoplenty/api/BOPBiomeManager.java +++ b/src/main/java/biomesoplenty/api/BOPBiomeManager.java @@ -6,6 +6,7 @@ import java.util.List; import net.minecraft.util.WeightedRandom; import net.minecraft.world.biome.BiomeGenBase; import biomesoplenty.common.configuration.BOPConfigurationBiomeGen; +import biomesoplenty.common.configuration.BOPConfigurationBiomeWeights; import biomesoplenty.common.configuration.BOPConfigurationIDs; public class BOPBiomeManager @@ -23,7 +24,7 @@ public class BOPBiomeManager if (biome != null) { - BiomeEntry entry = new BiomeEntry(biome, weight); + BiomeEntry entry = new BiomeEntry(biome, getConfiguredWeight(biome, biomeType, weight)); if (BOPConfigurationBiomeGen.config.get(biomeType + " Biomes To Generate", biome.biomeName, true).getBoolean(false)) { @@ -76,6 +77,11 @@ public class BOPBiomeManager return -1; } + private static int getConfiguredWeight(BiomeGenBase biome, String biomeType, int weight) + { + return BOPConfigurationBiomeWeights.config.get(biomeType + " Biome Weights", biome.biomeName, weight).getInt(weight); + } + public class TemperatureType { public static final int HOT = 0; diff --git a/src/main/java/biomesoplenty/common/configuration/BOPConfiguration.java b/src/main/java/biomesoplenty/common/configuration/BOPConfiguration.java index 3dd3da849..75c46c1f6 100644 --- a/src/main/java/biomesoplenty/common/configuration/BOPConfiguration.java +++ b/src/main/java/biomesoplenty/common/configuration/BOPConfiguration.java @@ -7,6 +7,7 @@ public class BOPConfiguration public static File mainConfigFile; public static File worldFeaturesConfigFile; public static File biomeGenConfigFile; + public static File biomeWeightsConfigFile; public static File terrainGenConfigFile; public static File villagesConfigFile; public static File strongholdsConfigFile; @@ -18,6 +19,7 @@ public class BOPConfiguration mainConfigFile = new File(configpath + "main.cfg"); worldFeaturesConfigFile = new File(configpath + "worldfeatures.cfg"); biomeGenConfigFile = new File(configpath + "biomegen.cfg"); + biomeWeightsConfigFile = new File(configpath + "biomeweights.cfg"); terrainGenConfigFile = new File(configpath + "terraingen.cfg"); villagesConfigFile = new File(configpath + "structures/villages.cfg"); strongholdsConfigFile = new File(configpath + "structures/strongholds.cfg"); @@ -26,6 +28,7 @@ public class BOPConfiguration BOPConfigurationMain.init(mainConfigFile); BOPConfigurationBiomeGen.init(biomeGenConfigFile); + BOPConfigurationBiomeWeights.init(biomeWeightsConfigFile); BOPConfigurationTerrainGen.init(terrainGenConfigFile); BOPConfigurationIDs.init(idConfigFile); BOPConfigurationMisc.init(miscConfigFile); diff --git a/src/main/java/biomesoplenty/common/configuration/BOPConfigurationBiomeWeights.java b/src/main/java/biomesoplenty/common/configuration/BOPConfigurationBiomeWeights.java new file mode 100644 index 000000000..e6ea87a5c --- /dev/null +++ b/src/main/java/biomesoplenty/common/configuration/BOPConfigurationBiomeWeights.java @@ -0,0 +1,15 @@ +package biomesoplenty.common.configuration; + +import java.io.File; + +import net.minecraftforge.common.config.Configuration; + +public class BOPConfigurationBiomeWeights +{ + public static Configuration config; + + public static void init(File configFile) + { + config = new Configuration(configFile); + } +} diff --git a/src/main/java/biomesoplenty/common/core/BOPBiomes.java b/src/main/java/biomesoplenty/common/core/BOPBiomes.java index 3c485ff4d..d0af72774 100644 --- a/src/main/java/biomesoplenty/common/core/BOPBiomes.java +++ b/src/main/java/biomesoplenty/common/core/BOPBiomes.java @@ -91,6 +91,7 @@ import biomesoplenty.common.biomes.overworld.subbiomes.BiomeGenVolcano; import biomesoplenty.common.biomes.overworld.techbiomes.BiomeGenDryRiver; import biomesoplenty.common.biomes.overworld.techbiomes.BiomeGenLushRiver; import biomesoplenty.common.configuration.BOPConfigurationBiomeGen; +import biomesoplenty.common.configuration.BOPConfigurationBiomeWeights; import biomesoplenty.common.configuration.BOPConfigurationIDs; import biomesoplenty.common.configuration.BOPConfigurationMisc; import biomesoplenty.common.utils.BOPLogger; @@ -112,6 +113,7 @@ public class BOPBiomes { BOPConfigurationIDs.config.load(); BOPConfigurationBiomeGen.config.load(); + BOPConfigurationBiomeWeights.config.load(); registerBiomes(); } catch (Exception e) @@ -122,6 +124,7 @@ public class BOPBiomes { if (BOPConfigurationIDs.config.hasChanged()) BOPConfigurationIDs.config.save(); if (BOPConfigurationBiomeGen.config.hasChanged()) BOPConfigurationBiomeGen.config.save(); + if (BOPConfigurationBiomeWeights.config.hasChanged()) BOPConfigurationBiomeWeights.config.save(); } addBiomesToDictionary();