mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-12 10:45:50 -07:00
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:
@@ -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()) {
|
||||
|
Reference in New Issue
Block a user