Relookup Entity Save ID if was null during precache

Should fix #1280

Citizens hijacks entity map, and im guessing under the right conditions
the result might actually be null during entity creation

Pre the cache patch, the id is looked up on save, so it was fine.

Now, if its null and the save ID is requested, we will try to look
it up again and cache it if found.
This commit is contained in:
Aikar
2018-07-26 23:57:31 -04:00
parent 119ae29b37
commit 3c8a4cb1bb
21 changed files with 85 additions and 75 deletions

View File

@@ -9,7 +9,7 @@ This should hopefully avoid duplicate entities ever being created
if the entity was to end up in 2 different chunk slices
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 6de053781..be0b411e5 100644
index eaee492010..1787607622 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 {
@@ -46,7 +46,7 @@ index 6de053781..be0b411e5 100644
+
this.markDirty();
entity.setCurrentChunk(this);
entityCounts.increment(entity.entityKeyString);
entityCounts.increment(entity.getMinecraftKeyString());
@@ -0,0 +0,0 @@ public class Chunk {
// Paper start
@@ -59,9 +59,9 @@ index 6de053781..be0b411e5 100644
+ }
this.markDirty();
entity.setCurrentChunk(null);
entityCounts.decrement(entity.entityKeyString);
entityCounts.decrement(entity.getMinecraftKeyString());
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 7188d0c99..b3120d7cc 100644
index fdabb1e369..89f9bd347b 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper