Skip to content

Commit 68ba440

Browse files
Restore 0.6.x Biomes o' Plenty sub-biome generation 2 (#8)
1 parent fe10fa8 commit 68ba440

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

src/main/java/climateControl/ClimateControl.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import climateControl.utils.PropertyManager;
3535
import climateControl.utils.TaggedConfigManager;
3636
import climateControl.utils.Zeno410Logger;
37+
import cpw.mods.fml.common.Loader;
3738
import cpw.mods.fml.common.Mod;
3839
import cpw.mods.fml.common.Mod.EventHandler;
3940
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -72,6 +73,8 @@ public class ClimateControl {
7273

7374
private ExternalBiomePackage externalBiomesPackage;
7475

76+
public static boolean isBoPLoaded;
77+
7578
@EventHandler
7679
public void preInit(FMLPreInitializationEvent event) {
7780
addonConfigManager = new TaggedConfigManager("climatecontrol.cfg", "ClimateControl");
@@ -91,7 +94,6 @@ public void preInit(FMLPreInitializationEvent event) {
9194
config.load();
9295
// if (this.rescueOldCCMode) defaultSettings.set(config);
9396
// this.settings = defaultSettings.clone();
94-
9597
setupRegistry();
9698
newSettings.readFrom(config);
9799

@@ -110,6 +112,7 @@ public void preInit(FMLPreInitializationEvent event) {
110112
event.getSuggestedConfigurationFile());
111113
config.save();
112114

115+
isBoPLoaded = Loader.isModLoaded("BiomesOPlenty");
113116
}
114117

115118
@EventHandler

src/main/java/climateControl/api/ClimateControlSettings.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public void accept(Boolean accepted) {
279279
.booleanSetting(interveneInHighlandsName, false, "impose Climate Control generation on Highlands world types");
280280

281281
public final Mutable<Boolean> noBoPSubBiomes = climateControlCategory
282-
.booleanSetting(noBoPSubBiomesName, true, "suppress Bop sub-biome generation");
282+
.booleanSetting(noBoPSubBiomesName, false, "suppress Bop sub-biome generation");
283283

284284
public final Mutable<Boolean> interveneInBOPWorlds = climateControlCategory.booleanSetting(
285285
interveneInBOPName,
@@ -295,7 +295,7 @@ public void accept(Boolean accepted) {
295295
.booleanSetting(forceStartContinentName, true, "force small continent near origin");
296296

297297
public final boolean doBoPSubBiomes() {
298-
return noBoPSubBiomes.value() == false;
298+
return !noBoPSubBiomes.value();
299299
}
300300

301301
public final Mutable<String> externalBiomeNames = climateControlCategory.stringSetting(

src/main/java/climateControl/biomeSettings/BoPSubBiomeReplacer.java

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public BoPSubBiomeReplacer(IntRandomizer randomizer) {
3232
public int replacement(int currentBiomeId, IntRandomizer randomizer, int x, int z) {
3333

3434
List<BiomeEntry> currentSubBiomes = BOPBiomeManager.overworldSubBiomes[currentBiomeId];
35+
36+
if (currentBiomeId == BiomeGenBase.deepOcean.biomeID) {
37+
currentSubBiomes = null; // prevents BoP sub-biomes generating in deep ocean
38+
}
39+
3540
BOPSubBiome selectedSubBiome = currentSubBiomes != null
3641
? (BOPSubBiome) currentSubBiomes.get(randomizer.nextInt(currentSubBiomes.size())).biome
3742
: null;

src/main/java/climateControl/customGenLayer/GenLayerSubBiome.java

+14
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
import net.minecraft.world.gen.layer.GenLayer;
1212
import net.minecraft.world.gen.layer.IntCache;
1313

14+
import climateControl.ClimateControl;
15+
import climateControl.biomeSettings.BiomeReplacer;
16+
import climateControl.biomeSettings.BoPSubBiomeReplacer;
1417
import climateControl.genLayerPack.GenLayerPack;
1518
import climateControl.generator.BiomeSwapper;
1619
import climateControl.generator.SubBiomeChooser;
@@ -24,6 +27,8 @@ public class GenLayerSubBiome extends GenLayerPack {
2427
private final SubBiomeChooser subBiomeChooser;
2528
private final BiomeSwapper mBiomes;
2629

30+
private BiomeReplacer BoPSubBiomeReplacer;
31+
2732
private IntRandomizer randomCallback = new IntRandomizer() {
2833

2934
public int nextInt(int maximum) {
@@ -39,6 +44,9 @@ public GenLayerSubBiome(long p_i45479_1_, GenLayer biomes, GenLayer rivers, SubB
3944
this.subBiomeChooser = subBiomeChooser;
4045
this.mBiomes = mBiomes;
4146
this.initChunkSeed(0, 0);
47+
if (ClimateControl.isBoPLoaded && doBoP) {
48+
BoPSubBiomeReplacer = new BoPSubBiomeReplacer(randomCallback);
49+
}
4250
}
4351

4452
/**
@@ -110,6 +118,12 @@ public int[] getInts(int par1, int par2, int par3, int par4) {
110118
}
111119
}
112120
}
121+
// now the GenLayerHills stuff is done so run BoP subbiome replacements if it's on
122+
if (this.BoPSubBiomeReplacer != null) {
123+
this.initChunkSeed(j1 + par1, i1 + par2);
124+
aint2[j1 + i1 * par3] = BoPSubBiomeReplacer
125+
.replacement(aint2[j1 + i1 * par3], randomCallback, j1 + par1, i1 + par2);
126+
}
113127
}
114128
}
115129

0 commit comments

Comments
 (0)