Fixed allow-animals not applying to chunk generation.

Moved the legitimacy checking into World.addEntity for better organisation and to better account for future methods being added that control whether or not an entity should spawn.
This commit is contained in:
EvilSeph committed 2011-09-20 01:20:05 -04:00
1 parent d01a3acd82
commit 167febd8e6
3 files changed
+9 -13

No files matched your search

@@ -839,6 +839,13 @@ public class World implements IBlockAccess {
// CraftBukkit start
if (entity instanceof EntityLiving && !(entity instanceof EntityPlayer)) {
boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal;
boolean isMonster = entity instanceof EntityMonster || entity instanceof EntityGhast || entity instanceof EntitySlime;
if (spawnReason == SpawnReason.NATURAL || spawnReason == SpawnReason.SPAWNER || spawnReason == SpawnReason.BED || spawnReason == SpawnReason.EGG) {
if (isAnimal && !allowAnimals || isMonster && !allowMonsters) return false;
}
CreatureSpawnEvent event = CraftEventFactory.callCreatureSpawnEvent((EntityLiving) entity, spawnReason);
if (event.isCancelled()) {