Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-17 05:20:05 +01:00
Implement player.getCompassTarget
Dieser Commit ist enthalten in:
Ursprung
6fc4d9dcfe
Commit
9162a654c4
@ -7,6 +7,8 @@ import java.util.Set;
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||||
@ -56,6 +58,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String displayName;
|
public String displayName;
|
||||||
|
public Location compassTarget;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public void l() {
|
public void l() {
|
||||||
|
@ -63,8 +63,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
Long lastPacket;
|
Long lastPacket;
|
||||||
|
|
||||||
// Store the last block right clicked and what type it was
|
// Store the last block right clicked and what type it was
|
||||||
private CraftBlock lastRightClicked;
|
|
||||||
private BlockFace lastRightClickedFace;
|
|
||||||
private int lastMaterial;
|
private int lastMaterial;
|
||||||
|
|
||||||
public CraftPlayer getPlayer() {
|
public CraftPlayer getPlayer() {
|
||||||
@ -513,6 +511,12 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void b(Packet packet) {
|
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.b.a(packet);
|
||||||
this.g = this.f;
|
this.g = this.f;
|
||||||
}
|
}
|
||||||
|
@ -171,6 +171,7 @@ public class ServerConfigurationManager {
|
|||||||
entityplayer1.id = entityplayer.id;
|
entityplayer1.id = entityplayer.id;
|
||||||
entityplayer1.a = entityplayer.a;
|
entityplayer1.a = entityplayer.a;
|
||||||
entityplayer1.displayName = entityplayer.displayName; // CraftBukkit
|
entityplayer1.displayName = entityplayer.displayName; // CraftBukkit
|
||||||
|
entityplayer1.compassTarget = entityplayer.compassTarget; // CraftBukkit
|
||||||
((WorldServer) entityplayer.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
((WorldServer) entityplayer.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
|
||||||
|
|
||||||
while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) {
|
while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) {
|
||||||
|
@ -125,7 +125,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setCompassTarget(Location loc) {
|
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) {
|
public void chat(String msg) {
|
||||||
@ -159,6 +164,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
newEntity.locX = location.getX();
|
newEntity.locX = location.getX();
|
||||||
newEntity.locY = location.getY();
|
newEntity.locY = location.getY();
|
||||||
newEntity.locZ = location.getZ();
|
newEntity.locZ = location.getZ();
|
||||||
|
newEntity.compassTarget = entity.compassTarget;
|
||||||
newWorld.u.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
|
newWorld.u.d((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
|
||||||
|
|
||||||
teleportSuccess = newEntity.a.teleport(location);
|
teleportSuccess = newEntity.a.teleport(location);
|
||||||
@ -176,6 +182,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
|
|
||||||
entity.a.e = newEntity;
|
entity.a.e = newEntity;
|
||||||
this.entity = newEntity;
|
this.entity = newEntity;
|
||||||
|
|
||||||
|
setCompassTarget(getCompassTarget());
|
||||||
}
|
}
|
||||||
|
|
||||||
return teleportSuccess;
|
return teleportSuccess;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren