Minor Improvements to Biomes

Shifted the duplicate code from our biome classes into a single parent
class. Also added checks so that Minecraft crashes if a biome ID
conflict occurs. This is to put an end to the recent streak of posts on
our MCF thread about people experiencing issues because DD and BoP have
conflicts out of the box.
This commit is contained in:
SenseiKiwi 2014-03-07 18:35:20 -04:00
parent baa5555547
commit 89baf624eb
4 changed files with 50 additions and 51 deletions

View file

@ -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());
}

View file

@ -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");
}
}

View file

@ -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");
}
}

View file

@ -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!");
}
}
}
}