Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/main/java/climateControl/ClimateControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand All @@ -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);

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

isBoPLoaded = Loader.isModLoaded("BiomesOPlenty");
}

@EventHandler
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/climateControl/api/ClimateControlSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public void accept(Boolean accepted) {
.booleanSetting(interveneInHighlandsName, false, "impose Climate Control generation on Highlands world types");

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

public final Mutable<Boolean> interveneInBOPWorlds = climateControlCategory.booleanSetting(
interveneInBOPName,
Expand All @@ -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<String> externalBiomeNames = climateControlCategory.stringSetting(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public BoPSubBiomeReplacer(IntRandomizer randomizer) {
public int replacement(int currentBiomeId, IntRandomizer randomizer, int x, int z) {

List<BiomeEntry> 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;
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/climateControl/customGenLayer/GenLayerSubBiome.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -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);
}
}

/**
Expand Down Expand Up @@ -110,6 +118,12 @@ 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);
aint2[j1 + i1 * par3] = BoPSubBiomeReplacer
.replacement(aint2[j1 + i1 * par3], randomCallback, j1 + par1, i1 + par2);
}
}
}

Expand Down
Loading