Use entity.dead instead of entity.die()

Fixes #3096
This commit is contained in:
Aikar 2020-04-04 21:09:27 -04:00
parent 89718e929a
commit 9bd9caa6ae
5 changed files with 14 additions and 9 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 68cde33565..1d47e47370 100644
index 68cde33565..3267e87259 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 implements IChunkAccess {
@ -52,6 +52,7 @@ index 68cde33565..1d47e47370 100644
if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null);
+ if (entitySlices[i] == entity.entitySlice) {
+ entity.entitySlice = null;
+ entity.inChunk = false;
+ }
if (!this.entitySlices[i].remove(entity)) {
return;

View file

@ -14,7 +14,7 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear
Combined, this adds up a lot.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 06b4dc6284..fc01aa68eb 100644
index b6ba0cb79e..38ab4197b2 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 implements IChunkAccess {

View file

@ -81,7 +81,7 @@ index 4ba72275b9..572679e4d1 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index c464d69623..3882e5b2a6 100644
index a51de83cf5..c263a8250d 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 implements IChunkAccess {
@ -105,7 +105,7 @@ index 1a20f105b5..d522d7238d 100644
this.uniqueID = uuid;
this.am = this.uniqueID.toString();
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index f640d2ac76..5763538905 100644
index f640d2ac76..863c47b761 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -0,0 +0,0 @@
@ -135,7 +135,11 @@ index f640d2ac76..5763538905 100644
import java.util.concurrent.CompletionException;
import java.util.concurrent.Executor;
@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
entity.die();
// CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
boolean needsRemoval = false;
if (chunk.needsDecoration && !this.world.getServer().getServer().getSpawnNPCs() && entity instanceof NPC) {
- entity.die();
+ entity.dead = true; // Paper
needsRemoval = true;
}
-
@ -166,7 +170,7 @@ index f640d2ac76..5763538905 100644
+ && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < world.paperConfig.duplicateUUIDDeleteRange
+ ) {
+ if (World.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ entity.die();
+ entity.dead = true;
+ return;
+ }
+ if (other != null && !other.dead) {
@ -178,7 +182,7 @@ index f640d2ac76..5763538905 100644
+ }
+ case DELETE: {
+ if (World.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about.");
+ entity.die();
+ entity.dead = true;
+ break;
+ }
+ default:

View file

@ -23,7 +23,7 @@ index b839769cea..5acad8e44f 100644
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ());
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 1d47e47370..c464d69623 100644
index 3267e87259..a51de83cf5 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 implements IChunkAccess {

View file

@ -111,7 +111,7 @@ index e76528f199..e650a2e48d 100644
return this.d(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ());
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index fc01aa68eb..92065fe029 100644
index 38ab4197b2..971c0315d5 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 implements IChunkAccess {