From 931d59f923984939c26ae7c19a3cc49064029bd6 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 15 May 2014 06:19:30 +1000 Subject: [PATCH 1/2] Biome weights (For BoP biomes) are now configurable. Closes #240 --- .../java/biomesoplenty/api/BOPBiomeManager.java | 8 +++++++- .../common/configuration/BOPConfiguration.java | 3 +++ .../BOPConfigurationBiomeWeights.java | 15 +++++++++++++++ .../java/biomesoplenty/common/core/BOPBiomes.java | 3 +++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/main/java/biomesoplenty/common/configuration/BOPConfigurationBiomeWeights.java 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(); From 8851e07a61fecdae882cc15793a713d4df4a364b Mon Sep 17 00:00:00 2001 From: Adubbz Date: Thu, 15 May 2014 18:55:02 +1000 Subject: [PATCH 2/2] Readded poison lakes. Closes #227 --- .../biomesoplenty/common/biomes/overworld/BiomeGenBog.java | 2 +- .../common/biomes/overworld/BiomeGenLushSwamp.java | 2 +- .../common/biomes/overworld/BiomeGenMysticGrove.java | 4 +--- .../common/biomes/overworld/BiomeGenOminousWoods.java | 2 +- .../common/biomes/overworld/BiomeGenSludgepit.java | 2 +- .../common/biomes/overworld/BiomeGenWasteland.java | 2 +- .../common/world/decoration/BOPWorldFeatures.java | 1 + .../common/world/generation/WorldGenFieldAssociation.java | 1 + 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenBog.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenBog.java index 9459a1c7b..8af29f72c 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenBog.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenBog.java @@ -41,7 +41,7 @@ public class BiomeGenBog extends BOPBiome this.bopWorldFeatures.setFeature("riverCanePerChunk", 8); this.bopWorldFeatures.setFeature("blueMilksPerChunk", 1); this.bopWorldFeatures.setFeature("waterLakesPerChunk", 6); - //TODO: FEATURE this.bopWorldFeatures.poisonWaterPerChunk = 2; + this.bopWorldFeatures.setFeature("poisonLakesPerChunk", 2); this.bopWorldFeatures.setFeature("waterReedsPerChunk", 8); this.bopWorldFeatures.setFeature("koruPerChunk", 1); this.bopWorldFeatures.setFeature("shrubsPerChunk", 10); diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenLushSwamp.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenLushSwamp.java index b3a2a0beb..31586700c 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenLushSwamp.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenLushSwamp.java @@ -37,7 +37,7 @@ public class BiomeGenLushSwamp extends BOPBiome this.bopWorldFeatures.setFeature("highCattailsPerChunk", 5); this.bopWorldFeatures.setFeature("riverCanePerChunk", 5); this.bopWorldFeatures.setFeature("algaePerChunk", 3); - //TODO: FEATURE this.bopWorldFeatures.poisonWaterPerChunk = 2; + this.bopWorldFeatures.setFeature("poisonLakesPerChunk", 2); this.bopWorldFeatures.setFeature("wildCarrotsPerChunk", 1); this.bopWorldFeatures.setFeature("shrubsPerChunk", 5); this.bopWorldFeatures.setFeature("koruPerChunk", 1); diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenMysticGrove.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenMysticGrove.java index eb31d707e..8439cdbef 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenMysticGrove.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenMysticGrove.java @@ -21,9 +21,7 @@ public class BiomeGenMysticGrove extends BOPBiome { super(id); - //TODO: setHeight() this.setHeight(biomeHeight); - //TODO: setColor() this.setColor(6934491); this.setTemperatureRainfall(0.9F, 1.0F); @@ -43,7 +41,7 @@ public class BiomeGenMysticGrove extends BOPBiome this.bopWorldFeatures.setFeature("bopFlowersPerChunk", 10); this.bopWorldFeatures.setFeature("sproutsPerChunk", 1); this.bopWorldFeatures.setFeature("blueMilksPerChunk", 1); - //TODO: FEATURE customBiomeDecorator.poisonWaterPerChunk = 1; + this.bopWorldFeatures.setFeature("poisonLakesPerChunk", 1); this.bopWorldFeatures.setFeature("cloverPatchesPerChunk", 10); this.bopWorldFeatures.setFeature("shrubsPerChunk", 4); diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenOminousWoods.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenOminousWoods.java index 7336150d2..a47399e41 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenOminousWoods.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenOminousWoods.java @@ -52,7 +52,7 @@ public class BiomeGenOminousWoods extends BOPBiome this.bopWorldFeatures.setFeature("poisonIvyPerChunk", 3); this.bopWorldFeatures.setFeature("leafPilesPerChunk", 2); this.bopWorldFeatures.setFeature("deadLeafPilesPerChunk", 4); - //TODO: FEATURE customBiomeDecorator.poisonWaterPerChunk = 15; + this.bopWorldFeatures.setFeature("poisonLakesPerChunk", 15); this.bopWorldFeatures.setFeature("bopFlowersPerChunk", 1); this.bopWorldFeatures.setFeature("bopGrassPerChunk", 1); diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenSludgepit.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenSludgepit.java index bf52e410a..8cff1ad71 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenSludgepit.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenSludgepit.java @@ -45,7 +45,7 @@ public class BiomeGenSludgepit extends BOPBiome this.bopWorldFeatures.setFeature("mudPerChunk", 5); this.bopWorldFeatures.setFeature("algaePerChunk", 2); - //TODO: FEATURE customBiomeDecorator.poisonWaterPerChunk = 5; + this.bopWorldFeatures.setFeature("poisonLakesPerChunk", 5); this.bopWorldFeatures.setFeature("waterReedsPerChunk", 6); this.bopWorldFeatures.setFeature("koruPerChunk", 1); this.bopWorldFeatures.setFeature("leafPilesPerChunk", 5); diff --git a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenWasteland.java b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenWasteland.java index eab4192f7..32a949f98 100644 --- a/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenWasteland.java +++ b/src/main/java/biomesoplenty/common/biomes/overworld/BiomeGenWasteland.java @@ -32,7 +32,7 @@ public class BiomeGenWasteland extends BOPBiome this.theBiomeDecorator.treesPerChunk = 0; this.theBiomeDecorator.grassPerChunk = 20; - //TODO: FEATURE customBiomeDecorator.poisonWaterPerChunk = 10; + this.bopWorldFeatures.setFeature("poisonLakesPerChunk", 10); this.bopWorldFeatures.setFeature("waterLakesPerChunk", 2); this.bopWorldFeatures.setFeature("wasteland1PerChunk", 1); this.bopWorldFeatures.setFeature("wasteland2PerChunk", 1); diff --git a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java index 69a50c399..da17d3a8b 100644 --- a/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java +++ b/src/main/java/biomesoplenty/common/world/decoration/BOPWorldFeatures.java @@ -38,6 +38,7 @@ public class BOPWorldFeatures addFeature("waterLakesPerChunk", 0); addFeature("lavaLakesPerChunk", 0); + addFeature("poisonLakesPerChunk", 0); addFeature("mudPerChunk", 0); addFeature("riverCanePerChunk", 0); diff --git a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java index 7d1285452..f1e865ac5 100644 --- a/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java +++ b/src/main/java/biomesoplenty/common/world/generation/WorldGenFieldAssociation.java @@ -127,6 +127,7 @@ public class WorldGenFieldAssociation associateFeatureForced("waterLakesPerChunk", new WorldGenLakes(Blocks.water), LakesForcedGenerator.class); associateFeatureForced("lavaLakesPerChunk", new WorldGenLakes(Blocks.lava), LakesForcedGenerator.class); + associateFeatureForced("poisonLakesPerChunk", new WorldGenLakes(BOPBlockHelper.get("poison")), LakesForcedGenerator.class); associateFeatureForced("generateMelons", new WorldGenMelon(), MelonForcedGenerator.class); }