From 25ca3f41afe4a4f2a0b0ceb899afb439910acc80 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Thu, 2 May 2013 12:06:55 -0500 Subject: [PATCH] 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. --- src/main/java/net/minecraft/server/World.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index a7de90ee4d..6d3e022123 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -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;