--- a/net/minecraft/server/SpawnerCreature.java +++ b/net/minecraft/server/SpawnerCreature.java @@ -7,6 +7,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +// CraftBukkit start +import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +// CraftBukkit end + public final class SpawnerCreature { private static final Logger LOGGER = LogManager.getLogger(); @@ -88,9 +92,12 @@ entityinsentient.setPositionRotation((double) f, (double) k, (double) f1, worldserver.random.nextFloat() * 360.0F, 0.0F); if ((d0 <= 16384.0D || !entityinsentient.isTypeNotPersistent(d0)) && entityinsentient.a((GeneratorAccess) worldserver, EnumMobSpawn.NATURAL) && entityinsentient.a((IWorldReader) worldserver)) { groupdataentity = entityinsentient.prepare(worldserver, worldserver.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); - ++i; - ++i2; - worldserver.addEntity(entityinsentient); + // CraftBukkit start + if (worldserver.addEntity(entityinsentient, SpawnReason.NATURAL)) { + ++i; + ++i2; + } + // CraftBukkit end if (i >= entityinsentient.getMaxSpawnGroup()) { return; } @@ -216,7 +223,7 @@ if (entityinsentient.a(generatoraccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.a((IWorldReader) generatoraccess)) { groupdataentity = entityinsentient.prepare(generatoraccess, generatoraccess.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null); - generatoraccess.addEntity(entityinsentient); + generatoraccess.addEntity(entityinsentient, SpawnReason.CHUNK_GEN); // CraftBukkit flag = true; } }