Fix animal spawning ignoring limits. Fixes BUKKIT-4180

Minecraft 1.5.2 changed mob spawning by ignoring persistent mobs from the
mob count. In CraftBukkit all mobs that previously used a separate hard
coded persistence system were ported to instead use this one. This causes
all animals to be persistent by default and thus never be counted. To
correct this issue we consider if the mob would be considered persistent
in the hard coded system as well when deciding if a mob should count.
This commit is contained in:
Travis Watkins 2013-05-02 12:06:55 -05:00
parent 401a6809be
commit 25ca3f41af

View File

@ -2337,9 +2337,18 @@ public abstract class World implements IBlockAccess {
for (int j = 0; j < this.entityList.size(); ++j) {
Entity entity = (Entity) this.entityList.get(j);
if ((!(entity instanceof EntityLiving) || !((EntityLiving) entity).bU()) && oclass.isAssignableFrom(entity.getClass())) {
// CraftBukkit start - Split out persistent check, don't apply it to special persistent mobs
if (entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) entity;
if (!entityliving.isTypeNotPersistent() && entityliving.bU()) { // Should be isPersistent
continue;
}
}
if (oclass.isAssignableFrom(entity.getClass())) {
++i;
}
// CraftBukkit end
}
return i;