diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-05-02 12:06:55 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-05-02 12:24:31 -0500 |
commit | 25ca3f41afe4a4f2a0b0ceb899afb439910acc80 (patch) | |
tree | ef37af6bc31aacd4b0cef721447146c09e6e7410 /src/main | |
parent | 401a6809be71112f35f811fedb79e1210c87a656 (diff) | |
download | craftbukkit-25ca3f41afe4a4f2a0b0ceb899afb439910acc80.tar craftbukkit-25ca3f41afe4a4f2a0b0ceb899afb439910acc80.tar.gz craftbukkit-25ca3f41afe4a4f2a0b0ceb899afb439910acc80.tar.lz craftbukkit-25ca3f41afe4a4f2a0b0ceb899afb439910acc80.tar.xz craftbukkit-25ca3f41afe4a4f2a0b0ceb899afb439910acc80.zip |
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.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/net/minecraft/server/World.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index a7de90ee..6d3e0221 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; |