mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Fixed invisibility after cross-world teleportation
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
a56535ac56
commit
88c99f6a7b
1 changed files with 22 additions and 13 deletions
|
@ -116,28 +116,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void teleportTo(Location location) {
|
public void teleportTo(Location location) {
|
||||||
boolean worldChange = location.getWorld() != getWorld();
|
WorldServer oldWorld = ((CraftWorld)getWorld()).getHandle();
|
||||||
|
WorldServer newWorld = ((CraftWorld)location.getWorld()).getHandle();
|
||||||
ServerConfigurationManager manager = server.getHandle();
|
ServerConfigurationManager manager = server.getHandle();
|
||||||
|
|
||||||
if (worldChange) {
|
if (oldWorld != newWorld) {
|
||||||
manager.c.k.a(entity);
|
manager.c.k.a(entity);
|
||||||
manager.c.k.b(entity);
|
manager.c.k.b(entity);
|
||||||
manager.d.b(entity);
|
manager.d.b(entity);
|
||||||
entity.world.e(entity);
|
manager.b.remove(entity);
|
||||||
|
oldWorld.e(entity);
|
||||||
|
|
||||||
entity.world = ((CraftWorld)location.getWorld()).getHandle();
|
EntityPlayer newEntity = new EntityPlayer(manager.c, newWorld, entity.name, new ItemInWorldManager(newWorld));
|
||||||
|
|
||||||
entity.c = new ItemInWorldManager(((CraftWorld)location.getWorld()).getHandle());
|
newEntity.id = entity.id;
|
||||||
entity.c.a = entity;
|
newEntity.a = entity.a;
|
||||||
|
newEntity.health = entity.health;
|
||||||
|
newEntity.fireTicks = entity.fireTicks;
|
||||||
|
newWorld.A.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
|
||||||
|
|
||||||
((WorldServer)entity.world).A.d((int) entity.locX >> 4, (int) entity.locZ >> 4);
|
newEntity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
}
|
manager.d.a(newEntity);
|
||||||
|
newWorld.a(newEntity);
|
||||||
|
manager.b.add(newEntity);
|
||||||
|
newEntity.l();
|
||||||
|
|
||||||
entity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
entity.a.e = newEntity;
|
||||||
|
newEntity.inventory = entity.inventory;
|
||||||
if (worldChange) {
|
newEntity.inventory.e = newEntity;
|
||||||
manager.d.a(entity);
|
entity = newEntity;
|
||||||
entity.world.a(entity);
|
} else {
|
||||||
|
entity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue