2018-07-19 01:16:19 +02:00
|
|
|
From 0eda9304279c487452a245265cbe6424c3ffe621 Mon Sep 17 00:00:00 2001
|
2018-06-11 02:09:56 +02:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Sun, 10 Jun 2018 20:04:42 -0400
|
|
|
|
Subject: [PATCH] Properly remove entities on dimension teleport
|
|
|
|
|
|
|
|
To teleport an entity between dimensions, the server makes a copy
|
|
|
|
and puts the copy in the new location, and marks the old one dead.
|
|
|
|
|
|
|
|
If this method got called for the same world in the same tick,
|
|
|
|
the entity would not have been removed from the UUID map, and the
|
|
|
|
world readd would fail.
|
|
|
|
|
|
|
|
This can be triggered even with a plugin if the entity is teleported
|
|
|
|
twice in the same tick, from world A to B, then back from B to A.
|
|
|
|
|
|
|
|
The re-add to A will fail to add the entity to the world. It will
|
|
|
|
actually be there, but it will not be visible on the client until
|
|
|
|
the server is restarted to re-try the add to world process again.
|
|
|
|
|
|
|
|
This bug was unlikely to be seen by many due to the double teleport
|
|
|
|
requirement, but plugins (such as my own) use this method to
|
|
|
|
trigger a "reload" of the entity on the client.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2018-07-19 01:16:19 +02:00
|
|
|
index cd1639e26..ea42800ae 100644
|
2018-06-11 02:09:56 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2018-07-19 01:16:19 +02:00
|
|
|
@@ -2594,7 +2594,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2018-06-11 02:09:56 +02:00
|
|
|
}
|
|
|
|
// CraftBukkit end */
|
|
|
|
|
|
|
|
- this.world.kill(this);
|
|
|
|
+ this.world.removeEntity(this); // Paper - Fully remove entity, can't have dupes in the UUID map
|
|
|
|
this.dead = false;
|
|
|
|
this.world.methodProfiler.a("reposition");
|
|
|
|
/* CraftBukkit start - Handled in calculateTarget
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
2018-07-19 01:16:19 +02:00
|
|
|
index 4ac2d39c5..d6d3ffa6f 100644
|
2018-06-11 02:09:56 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
2018-07-19 01:16:19 +02:00
|
|
|
@@ -1025,6 +1025,7 @@ public class WorldServer extends World implements IAsyncTaskHandler {
|
2018-06-11 02:09:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected void c(Entity entity) {
|
|
|
|
+ if (!entity.valid) return; // Paper - Already removed, dont fire twice - this looks like it can happen even without our changes
|
|
|
|
super.c(entity);
|
|
|
|
this.entitiesById.d(entity.getId());
|
|
|
|
this.entitiesByUUID.remove(entity.getUniqueID());
|
|
|
|
--
|
2018-06-30 07:40:52 +02:00
|
|
|
2.18.0
|
2018-06-11 02:09:56 +02:00
|
|
|
|