diff options
author | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-02-06 14:03:28 +0000 |
---|---|---|
committer | Dinnerbone <dinnerbone@dinnerbone.com> | 2011-02-07 01:51:06 +0000 |
commit | dcabbda57c2b3d1af21e652ba9d896da13eca455 (patch) | |
tree | 4411cc95e7d3da25ad9b023c29034d4d49138ec4 /src/main/java | |
parent | 590b3874a85404c54fe2f46e76e72e8ff09fcdf6 (diff) | |
download | craftbukkit-dcabbda57c2b3d1af21e652ba9d896da13eca455.tar craftbukkit-dcabbda57c2b3d1af21e652ba9d896da13eca455.tar.gz craftbukkit-dcabbda57c2b3d1af21e652ba9d896da13eca455.tar.lz craftbukkit-dcabbda57c2b3d1af21e652ba9d896da13eca455.tar.xz craftbukkit-dcabbda57c2b3d1af21e652ba9d896da13eca455.zip |
Fixed invisibility after cross-world teleportation
Diffstat (limited to 'src/main/java')
3 files changed, 28 insertions, 19 deletions
diff --git a/src/main/java/net/minecraft/server/InventoryPlayer.java b/src/main/java/net/minecraft/server/InventoryPlayer.java index 6867dcd5..c918c46e 100644 --- a/src/main/java/net/minecraft/server/InventoryPlayer.java +++ b/src/main/java/net/minecraft/server/InventoryPlayer.java @@ -5,7 +5,7 @@ public class InventoryPlayer implements IInventory { public ItemStack[] a = new ItemStack[36]; public ItemStack[] b = new ItemStack[4]; public int c = 0; - private EntityHuman e; + public EntityHuman e; // Craftbukkit - public private ItemStack f; public boolean d = false; diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 33dfd642..0ae1d3e6 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -33,7 +33,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { public NetworkManager b; public boolean c = false; private MinecraftServer d; - private EntityPlayer e; + public EntityPlayer e; // Craftbukkit - public private int f = 0; private double g; private double h; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index f59b6b70..f1c62d50 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -116,28 +116,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override 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(); - if (worldChange) { + if (oldWorld != newWorld) { manager.c.k.a(entity); manager.c.k.b(entity); manager.d.b(entity); - entity.world.e(entity); - - entity.world = ((CraftWorld)location.getWorld()).getHandle(); - - entity.c = new ItemInWorldManager(((CraftWorld)location.getWorld()).getHandle()); - entity.c.a = entity; - - ((WorldServer)entity.world).A.d((int) entity.locX >> 4, (int) entity.locZ >> 4); - } - - entity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - - if (worldChange) { - manager.d.a(entity); - entity.world.a(entity); + manager.b.remove(entity); + oldWorld.e(entity); + + EntityPlayer newEntity = new EntityPlayer(manager.c, newWorld, entity.name, new ItemInWorldManager(newWorld)); + + newEntity.id = entity.id; + newEntity.a = entity.a; + newEntity.health = entity.health; + newEntity.fireTicks = entity.fireTicks; + newWorld.A.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 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.e = newEntity; + newEntity.inventory = entity.inventory; + newEntity.inventory.e = newEntity; + entity = newEntity; + } else { + entity.a.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); } } } |