3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00

SPIGOT-2115: Fix entities being added to the world multiple times when teleported

Dieser Commit ist enthalten in:
Thinkofname 2016-04-02 01:12:03 +01:00
Ursprung 048849ce51
Commit f01861f80b

Datei anzeigen

@ -588,12 +588,12 @@
+ double d1 = enter.getZ(); + double d1 = enter.getZ();
+ double d2 = 8.0D; + double d2 = 8.0D;
+ /* + /*
+ double d0 = entity.locX; double d0 = entity.locX;
+ double d1 = entity.locZ; double d1 = entity.locZ;
+ double d2 = 8.0D; double d2 = 8.0D;
+ float f = entity.yaw; float f = entity.yaw;
+
+ worldserver.methodProfiler.a("moving"); worldserver.methodProfiler.a("moving");
+ */ + */
+ if (worldserver1.dimension == -1) { + if (worldserver1.dimension == -1) {
+ d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b()+ 16.0D, worldserver1.getWorldBorder().d() - 16.0D); + d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b()+ 16.0D, worldserver1.getWorldBorder().d() - 16.0D);
@ -663,12 +663,12 @@
+ int i = worldserver.dimension; + int i = worldserver.dimension;
+ +
+ /* + /*
double d0 = entity.locX; + double d0 = entity.locX;
double d1 = entity.locZ; + double d1 = entity.locZ;
double d2 = 8.0D; + double d2 = 8.0D;
float f = entity.yaw; + float f = entity.yaw;
+
worldserver.methodProfiler.a("moving"); + worldserver.methodProfiler.a("moving");
+ */ + */
+ entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); + entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch());
+ if (entity.isAlive()) { + if (entity.isAlive()) {
@ -687,7 +687,7 @@
blockposition = worldserver1.getSpawn(); blockposition = worldserver1.getSpawn();
} else { } else {
blockposition = worldserver1.getDimensionSpawn(); blockposition = worldserver1.getDimensionSpawn();
@@ -526,15 +903,26 @@ @@ -526,16 +903,27 @@
worldserver.entityJoinedWorld(entity, false); worldserver.entityJoinedWorld(entity, false);
} }
} }
@ -703,6 +703,7 @@
if (entity.isAlive()) { if (entity.isAlive()) {
- entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); - entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
- worldserver1.getTravelAgent().a(entity, f); - worldserver1.getTravelAgent().a(entity, f);
- worldserver1.addEntity(entity);
+ // entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); + // entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch);
+ // worldserver1.getTravelAgent().a(entity, f); + // worldserver1.getTravelAgent().a(entity, f);
+ if (portal) { + if (portal) {
@ -713,9 +714,10 @@
+ entity.getBukkitEntity().setVelocity(velocity); + entity.getBukkitEntity().setVelocity(velocity);
+ } + }
+ } + }
worldserver1.addEntity(entity); + // worldserver1.addEntity(entity);
worldserver1.entityJoinedWorld(entity, false); worldserver1.entityJoinedWorld(entity, false);
} }
@@ -543,6 +931,7 @@ @@ -543,6 +931,7 @@
} }