diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 1c53276409..6ec7560176 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -7,6 +7,8 @@ import java.util.Set; // CraftBukkit start import java.util.ArrayList; + +import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.entity.CraftEntity; @@ -56,6 +58,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public String displayName; + public Location compassTarget; // CraftBukkit end public void l() { diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 254c682d65..fd17fd3071 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -63,8 +63,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener { Long lastPacket; // Store the last block right clicked and what type it was - private CraftBlock lastRightClicked; - private BlockFace lastRightClickedFace; private int lastMaterial; public CraftPlayer getPlayer() { @@ -513,6 +511,12 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } public void b(Packet packet) { + // CraftBukkit + if (packet instanceof Packet6SpawnPosition) { + Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet; + this.e.compassTarget = new Location(getPlayer().getWorld(), packet6.a, packet6.b, packet6.c); + } + // CraftBukkit this.b.a(packet); this.g = this.f; } diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index f752e8b4da..34ac64974d 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -171,6 +171,7 @@ public class ServerConfigurationManager { entityplayer1.id = entityplayer.id; entityplayer1.a = entityplayer.a; entityplayer1.displayName = entityplayer.displayName; // CraftBukkit + entityplayer1.compassTarget = entityplayer.compassTarget; // CraftBukkit ((WorldServer) entityplayer.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4); while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index ef90643e89..adc09118a1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -125,7 +125,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void setCompassTarget(Location loc) { - getHandle().a.b(((Packet) (new Packet6SpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())))); + // Do not directly assign here, from the packethandler we'll assign it. + getHandle().a.b((Packet) new Packet6SpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); + } + + public Location getCompassTarget() { + return getHandle().compassTarget; } public void chat(String msg) { @@ -159,6 +164,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { newEntity.locX = location.getX(); newEntity.locY = location.getY(); newEntity.locZ = location.getZ(); + newEntity.compassTarget = entity.compassTarget; newWorld.u.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4); teleportSuccess = newEntity.a.teleport(location); @@ -176,6 +182,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { entity.a.e = newEntity; this.entity = newEntity; + + setCompassTarget(getCompassTarget()); } return teleportSuccess;