Fix placement of chunk tracking - Fixes #1199

Spigot had code that returned early in chunk add/remove methods.

This was causing our code added to set current chunks and counts to
be skipped over if the entity was default not persistent but made persistent.

This was the source of many issues

Fixes #1208
This commit is contained in:
Aikar
2018-07-15 02:44:37 -04:00
parent fe9d5b5570
commit 9a22d2fdec
12 changed files with 41 additions and 44 deletions

View File

@@ -14,7 +14,7 @@ Specially with servers using smaller mob spawn ranges than view distance, as wel
This patch returns mob counting to use all loaded chunks, and 17x17 division.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index e07ef14ed..aca1457b0 100644
index da7b59434..1157bc7eb 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -0,0 +0,0 @@ public class Chunk {
@@ -22,10 +22,11 @@ index e07ef14ed..aca1457b0 100644
}
- this.entitySlices[i].remove(entity);
+ if (!this.entitySlices[i].remove(entity)) { return; } // Paper
// Paper start - update counts
// Paper start
+ if (!this.entitySlices[i].remove(entity)) { return; }
entity.setCurrentChunk(null);
entityCounts.decrement(entity.entityKeyString);
if (entity instanceof EntityItem) {
itemCounts[i]--;
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 45a83ae99..ed22607d9 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java