Auto assign Biome Ids
Finds unused Biome IDs if the ones in the config are in use by other mods. Also saves change to config file. Changed default Biome Ids to 126 and 127 which are just below a block used by Minecraft.
This commit is contained in:
parent
e401a69782
commit
a016be6919
2 changed files with 21 additions and 3 deletions
|
@ -133,7 +133,6 @@ public class BuildCraftEnergy extends BuildCraftMod {
|
|||
biomeOilOcean = BiomeGenOilOcean.makeBiome(oilOceanBiomeId);
|
||||
}
|
||||
|
||||
|
||||
engineBlock = new BlockEngine();
|
||||
CoreProxy.proxy.registerBlock(engineBlock, ItemEngine.class);
|
||||
|
||||
|
@ -256,6 +255,25 @@ public class BuildCraftEnergy extends BuildCraftMod {
|
|||
'g', Blocks.glass, 'G', BuildCraftCore.ironGearItem, 'p', Blocks.piston});
|
||||
}
|
||||
|
||||
private int findUnusedBiomeID (String biomeName) {
|
||||
int freeBiomeID = 0;
|
||||
// code to find a free biome
|
||||
for (int i=1; i<256; i++) {
|
||||
if (BiomeGenBase.getBiomeGenArray()[i] == null) {
|
||||
freeBiomeID = i;
|
||||
return freeBiomeID;
|
||||
}
|
||||
}
|
||||
// failed to find any free biome IDs
|
||||
class BiomeIdLimitException extends RuntimeException {
|
||||
public BiomeIdLimitException(String biome) {
|
||||
super(String.format("You have a run out of free Biome Ids for %s", biome));
|
||||
}
|
||||
}
|
||||
|
||||
throw new BiomeIdLimitException(biomeName);
|
||||
}
|
||||
|
||||
private int findUnusedBiomeID (String biomeName) {
|
||||
int freeBiomeID = 0;
|
||||
// code to find a free biome
|
||||
|
|
|
@ -124,6 +124,6 @@ public class DefaultProps {
|
|||
public static final int FILLER_LIFESPAN_TOUGH = 20;
|
||||
public static final int FILLER_LIFESPAN_NORMAL = 6000;
|
||||
|
||||
public static int BIOME_OIL_OCEAN = 215;
|
||||
public static int BIOME_OIL_DESERT = 216;
|
||||
public static int BIOME_OIL_OCEAN = 126;
|
||||
public static int BIOME_OIL_DESERT = 127;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue