diff --git a/CraftBukkit-Patches/0019-Fix-Mob-Spawning-Relative-to-View-Distance.patch b/CraftBukkit-Patches/0019-Fix-Mob-Spawning-Relative-to-View-Distance.patch index 34beab1..f710cab 100644 --- a/CraftBukkit-Patches/0019-Fix-Mob-Spawning-Relative-to-View-Distance.patch +++ b/CraftBukkit-Patches/0019-Fix-Mob-Spawning-Relative-to-View-Distance.patch @@ -1,4 +1,4 @@ -From a49d752defabb9144a40695fc275e1dad271ef11 Mon Sep 17 00:00:00 2001 +From dd6315c676cba1aeb9765878d21b07ce45bf2645 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 21 Jun 2013 17:29:54 +1000 Subject: [PATCH] Fix Mob Spawning Relative to View Distance @@ -49,7 +49,7 @@ index 61e56ab..04cb6fb 100644 public boolean d(int i, int j, int k) { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index aa7698b..3a0d2ef 100644 +index aa7698b..02ca87f 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -27,6 +27,23 @@ public final class SpawnerCreature { @@ -57,10 +57,10 @@ index aa7698b..3a0d2ef 100644 } + // Spigot start - get entity count only from chunks being processed in b -+ private static int getEntityCount(WorldServer server, Class oClass) ++ private int getEntityCount(WorldServer server, Class oClass) + { + int i = 0; -+ for ( Long coord : b.keySet() ) ++ for ( Long coord : this.a.keySet() ) + { + int x = LongHash.msw( coord ); + int z = LongHash.lsw( coord ); @@ -99,7 +99,7 @@ index aa7698b..3a0d2ef 100644 + if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && (mobcnt = getEntityCount(worldserver, enumcreaturetype.a())) <= limit * this.a.size() / 256) { // Spigot - use per-world limits and use all loaded chunks Iterator iterator = this.a.keySet().iterator(); -+ int moblimit = (limit * b.size() / 256) - mobcnt + 1; // Spigot - up to 1 more than limit ++ int moblimit = (limit * this.a.size() / 256) - mobcnt + 1; // Spigot - up to 1 more than limit label110: - while (iterator.hasNext()) { + while (iterator.hasNext() && (moblimit > 0)) { // Spigot - while more allowed