From 08f20737d9430f62b3aabd4d48b6d37222cf911b Mon Sep 17 00:00:00 2001 From: Kotmatross <110309314+kotmatross28729@users.noreply.github.com> Date: Sat, 14 Dec 2024 17:56:07 +0300 Subject: [PATCH 1/2] Restore 0.6.x Biomes o' Plenty sub-biome generation 2 --- .../java/climateControl/ClimateControl.java | 5 ++++- .../api/ClimateControlSettings.java | 4 ++-- .../biomeSettings/BoPSubBiomeReplacer.java | 5 +++++ .../customGenLayer/GenLayerSubBiome.java | 18 ++++++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/main/java/climateControl/ClimateControl.java b/src/main/java/climateControl/ClimateControl.java index fb11893..ca79a07 100644 --- a/src/main/java/climateControl/ClimateControl.java +++ b/src/main/java/climateControl/ClimateControl.java @@ -34,6 +34,7 @@ import climateControl.utils.PropertyManager; import climateControl.utils.TaggedConfigManager; import climateControl.utils.Zeno410Logger; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; @@ -72,6 +73,8 @@ public class ClimateControl { private ExternalBiomePackage externalBiomesPackage; + public static boolean isBoPLoaded; + @EventHandler public void preInit(FMLPreInitializationEvent event) { addonConfigManager = new TaggedConfigManager("climatecontrol.cfg", "ClimateControl"); @@ -91,7 +94,6 @@ public void preInit(FMLPreInitializationEvent event) { config.load(); // if (this.rescueOldCCMode) defaultSettings.set(config); // this.settings = defaultSettings.clone(); - setupRegistry(); newSettings.readFrom(config); @@ -110,6 +112,7 @@ public void preInit(FMLPreInitializationEvent event) { event.getSuggestedConfigurationFile()); config.save(); + isBoPLoaded = Loader.isModLoaded("BiomesOPlenty"); } @EventHandler diff --git a/src/main/java/climateControl/api/ClimateControlSettings.java b/src/main/java/climateControl/api/ClimateControlSettings.java index a054eee..9bca6b1 100644 --- a/src/main/java/climateControl/api/ClimateControlSettings.java +++ b/src/main/java/climateControl/api/ClimateControlSettings.java @@ -279,7 +279,7 @@ public void accept(Boolean accepted) { .booleanSetting(interveneInHighlandsName, false, "impose Climate Control generation on Highlands world types"); public final Mutable noBoPSubBiomes = climateControlCategory - .booleanSetting(noBoPSubBiomesName, true, "suppress Bop sub-biome generation"); + .booleanSetting(noBoPSubBiomesName, false, "suppress Bop sub-biome generation"); public final Mutable interveneInBOPWorlds = climateControlCategory.booleanSetting( interveneInBOPName, @@ -295,7 +295,7 @@ public void accept(Boolean accepted) { .booleanSetting(forceStartContinentName, true, "force small continent near origin"); public final boolean doBoPSubBiomes() { - return noBoPSubBiomes.value() == false; + return !noBoPSubBiomes.value(); } public final Mutable externalBiomeNames = climateControlCategory.stringSetting( diff --git a/src/main/java/climateControl/biomeSettings/BoPSubBiomeReplacer.java b/src/main/java/climateControl/biomeSettings/BoPSubBiomeReplacer.java index 35ad88c..3c113fa 100644 --- a/src/main/java/climateControl/biomeSettings/BoPSubBiomeReplacer.java +++ b/src/main/java/climateControl/biomeSettings/BoPSubBiomeReplacer.java @@ -32,6 +32,11 @@ public BoPSubBiomeReplacer(IntRandomizer randomizer) { public int replacement(int currentBiomeId, IntRandomizer randomizer, int x, int z) { List currentSubBiomes = BOPBiomeManager.overworldSubBiomes[currentBiomeId]; + + if (currentBiomeId == BiomeGenBase.deepOcean.biomeID) { + currentSubBiomes = null; // prevents BoP sub-biomes generating in deep ocean + } + BOPSubBiome selectedSubBiome = currentSubBiomes != null ? (BOPSubBiome) currentSubBiomes.get(randomizer.nextInt(currentSubBiomes.size())).biome : null; diff --git a/src/main/java/climateControl/customGenLayer/GenLayerSubBiome.java b/src/main/java/climateControl/customGenLayer/GenLayerSubBiome.java index 9c68b59..6840c95 100644 --- a/src/main/java/climateControl/customGenLayer/GenLayerSubBiome.java +++ b/src/main/java/climateControl/customGenLayer/GenLayerSubBiome.java @@ -11,6 +11,9 @@ import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; +import climateControl.ClimateControl; +import climateControl.biomeSettings.BiomeReplacer; +import climateControl.biomeSettings.BoPSubBiomeReplacer; import climateControl.genLayerPack.GenLayerPack; import climateControl.generator.BiomeSwapper; import climateControl.generator.SubBiomeChooser; @@ -24,6 +27,8 @@ public class GenLayerSubBiome extends GenLayerPack { private final SubBiomeChooser subBiomeChooser; private final BiomeSwapper mBiomes; + private BiomeReplacer BoPSubBiomeReplacer; + private IntRandomizer randomCallback = new IntRandomizer() { public int nextInt(int maximum) { @@ -39,6 +44,9 @@ public GenLayerSubBiome(long p_i45479_1_, GenLayer biomes, GenLayer rivers, SubB this.subBiomeChooser = subBiomeChooser; this.mBiomes = mBiomes; this.initChunkSeed(0, 0); + if (ClimateControl.isBoPLoaded && doBoP) { + BoPSubBiomeReplacer = new BoPSubBiomeReplacer(randomCallback); + } } /** @@ -110,6 +118,16 @@ public int[] getInts(int par1, int par2, int par3, int par4) { } } } + // now the GenLayerHills stuff is done so run BoP subbiome replacements if it's on + if (this.BoPSubBiomeReplacer != null) { + this.initChunkSeed(j1 + par1, i1 + par2); + // int old = aint2[j1 + i1 * par3]; + aint2[j1 + i1 * par3] = BoPSubBiomeReplacer + .replacement(aint2[j1 + i1 * par3], randomCallback, j1 + par1, i1 + par2); + // if (aint2[j1 + i1 * par3] != old) { + // logger.info("BoP subbiome :"+old + " to "+aint2[j1 + i1 * par3]); + // } + } } } From cba671e0f8d647e39505e50fe020bc010035ec9f Mon Sep 17 00:00:00 2001 From: kotmatross28729 Date: Sun, 22 Dec 2024 10:37:16 +0300 Subject: [PATCH 2/2] Remove debug lines --- .../java/climateControl/customGenLayer/GenLayerSubBiome.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/climateControl/customGenLayer/GenLayerSubBiome.java b/src/main/java/climateControl/customGenLayer/GenLayerSubBiome.java index 6840c95..08263c9 100644 --- a/src/main/java/climateControl/customGenLayer/GenLayerSubBiome.java +++ b/src/main/java/climateControl/customGenLayer/GenLayerSubBiome.java @@ -121,12 +121,8 @@ public int[] getInts(int par1, int par2, int par3, int par4) { // now the GenLayerHills stuff is done so run BoP subbiome replacements if it's on if (this.BoPSubBiomeReplacer != null) { this.initChunkSeed(j1 + par1, i1 + par2); - // int old = aint2[j1 + i1 * par3]; aint2[j1 + i1 * par3] = BoPSubBiomeReplacer .replacement(aint2[j1 + i1 * par3], randomCallback, j1 + par1, i1 + par2); - // if (aint2[j1 + i1 * par3] != old) { - // logger.info("BoP subbiome :"+old + " to "+aint2[j1 + i1 * par3]); - // } } } }