mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 02:35:49 +01:00
SPIGOT-2115: Fix entities being added to the world multiple times when teleported
This commit is contained in:
parent
048849ce51
commit
f01861f80b
1 changed files with 16 additions and 14 deletions
|
@ -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 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue