mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-25 10:29:41 -05: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:
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()) {
|
||||
|
||||
Reference in new issue
Block a user