diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java b/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java index c44eaeef..a4e68444 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/mod_pocketDim.java @@ -61,6 +61,7 @@ import StevenDimDoors.mod_pocketDim.tileentities.TileEntityRift; import StevenDimDoors.mod_pocketDim.tileentities.TileEntityTransTrapdoor; import StevenDimDoors.mod_pocketDim.world.BiomeGenLimbo; import StevenDimDoors.mod_pocketDim.world.BiomeGenPocket; +import StevenDimDoors.mod_pocketDim.world.DDBiomeGenBase; import StevenDimDoors.mod_pocketDim.world.LimboProvider; import StevenDimDoors.mod_pocketDim.world.PocketProvider; import StevenDimDoors.mod_pocketDim.world.gateways.GatewayGenerator; @@ -207,6 +208,11 @@ public class mod_pocketDim itemStabilizedLinkSignature = (new ItemStabilizedRiftSignature(properties.StabilizedRiftSignatureItemID)).setUnlocalizedName("itemStabilizedRiftSig"); itemWorldThread = (new ItemWorldThread(properties.WorldThreadItemID)).setUnlocalizedName("itemWorldThread"); + // Check if other biomes have been registered with the same IDs we want. If so, crash Minecraft + // to notify the user instead of letting it pass and conflicting with Biomes o' Plenty. + DDBiomeGenBase.checkBiomes( new int[] { properties.LimboBiomeID, properties.PocketBiomeID } ); + + // Initialize our biomes mod_pocketDim.limboBiome = (new BiomeGenLimbo(properties.LimboBiomeID)); mod_pocketDim.pocketBiome = (new BiomeGenPocket(properties.PocketBiomeID)); @@ -282,7 +288,10 @@ public class mod_pocketDim @EventHandler public void onPostInitialization(FMLPostInitializationEvent event) - { + { + // Check in case other mods have registered over our biome IDs + DDBiomeGenBase.checkBiomes( new int[] { properties.LimboBiomeID, properties.PocketBiomeID } ); + ForgeChunkManager.setForcedChunkLoadingCallback(instance, new ChunkLoaderHelper()); } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/BiomeGenLimbo.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/BiomeGenLimbo.java index 243baf17..77eef463 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/BiomeGenLimbo.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/BiomeGenLimbo.java @@ -2,38 +2,10 @@ package StevenDimDoors.mod_pocketDim.world; import net.minecraft.world.biome.BiomeGenBase; -public class BiomeGenLimbo extends BiomeGenBase +public class BiomeGenLimbo extends DDBiomeGenBase { - public BiomeGenLimbo(int par1) + public BiomeGenLimbo(int biomeID) { - super(par1); - this.theBiomeDecorator.treesPerChunk = 0; - this.theBiomeDecorator.flowersPerChunk = 0; - this.theBiomeDecorator.grassPerChunk = 0; - this.setBiomeName("Limbo"); - this.setDisableRain(); - - this.spawnableMonsterList.clear(); - this.spawnableCreatureList.clear(); - this.spawnableWaterCreatureList.clear(); - this.spawnableCaveCreatureList.clear(); - // this.spawnableMonsterList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); - // this.spawnableMonsterList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0)); - - // this.spawnableCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); - // this.spawnableCreatureList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0)); - - // this.spawnableCaveCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); - // this.spawnableCaveCreatureList.add(new SpawnListEntry(MobObelisk.class, 300, 0, 0)); - - - - - } - - @Override - public float getSpawningChance() - { - return 0.00001F; + super(biomeID, "Limbo"); } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/BiomeGenPocket.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/BiomeGenPocket.java index e9dbdb76..8d09b7be 100644 --- a/src/main/java/StevenDimDoors/mod_pocketDim/world/BiomeGenPocket.java +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/BiomeGenPocket.java @@ -2,26 +2,10 @@ package StevenDimDoors.mod_pocketDim.world; import net.minecraft.world.biome.BiomeGenBase; -public class BiomeGenPocket extends BiomeGenBase +public class BiomeGenPocket extends DDBiomeGenBase { - public BiomeGenPocket(int par1) + public BiomeGenPocket(int biomeID) { - super(par1); - this.theBiomeDecorator.treesPerChunk = 0; - this.theBiomeDecorator.flowersPerChunk = 0; - this.theBiomeDecorator.grassPerChunk = 0; - this.setBiomeName("Pocket Dimension"); - this.setDisableRain(); - - this.spawnableMonsterList.clear(); - this.spawnableCreatureList.clear(); - this.spawnableWaterCreatureList.clear(); - this.spawnableCaveCreatureList.clear(); - // this.spawnableMonsterList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); - // this.spawnableCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); -// - // this.spawnableCaveCreatureList.add(new SpawnListEntry(MobObelisk.class, 1, 1, 1)); - - + super(biomeID, "Pocket Dimension"); } } diff --git a/src/main/java/StevenDimDoors/mod_pocketDim/world/DDBiomeGenBase.java b/src/main/java/StevenDimDoors/mod_pocketDim/world/DDBiomeGenBase.java new file mode 100644 index 00000000..f6e34281 --- /dev/null +++ b/src/main/java/StevenDimDoors/mod_pocketDim/world/DDBiomeGenBase.java @@ -0,0 +1,34 @@ +package StevenDimDoors.mod_pocketDim.world; + +import net.minecraft.world.biome.BiomeGenBase; + +public class DDBiomeGenBase extends BiomeGenBase +{ + public DDBiomeGenBase(int biomeID, String name) + { + super(biomeID); + this.setBiomeName(name); + this.theBiomeDecorator.treesPerChunk = 0; + this.theBiomeDecorator.flowersPerChunk = 0; + this.theBiomeDecorator.grassPerChunk = 0; + this.setDisableRain(); + + this.spawnableMonsterList.clear(); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + this.spawnableCaveCreatureList.clear(); + } + + public static void checkBiomes(int[] biomes) + { + for (int k = 0; k < biomes.length; k++) + { + if (biomeList[biomes[k]] != null && !(biomeList[biomes[k]] instanceof DDBiomeGenBase)) + { + // Crash Minecraft to avoid having people complain to us about strange things + // that are really the result of silent biome ID conflicts. + throw new IllegalStateException("There is a biome ID conflict between a biome from Dimensional Doors and another biome type. Fix your configuration!"); + } + } + } +}