use of net.glowstone.net.message.play.entity.EntityTeleportMessage in project Glowstone by GlowstoneMC.
the class GlowItemFrame method generateTeleportMessage.
void generateTeleportMessage(BlockFace face) {
int xoffset = 0;
int zoffset = 0;
int yaw = 0;
switch(getFacingNumber(face)) {
case 1:
xoffset = -32;
yaw = 64;
break;
case 2:
zoffset = -32;
yaw = -128;
break;
case 3:
xoffset = 32;
yaw = -64;
break;
case 0:
zoffset = 32;
yaw = 0;
break;
}
Location itemframelocation = location;
Key key = new Key(itemframelocation.getBlockX() >> 4, itemframelocation.getBlockZ() >> 4);
for (GlowPlayer player : getWorld().getRawPlayers()) {
if (player.canSeeChunk(key)) {
double x = location.getX();
double y = location.getY();
double z = location.getZ();
player.getSession().send(new EntityTeleportMessage(id, x + xoffset, y, z + zoffset, yaw, 0));
}
}
}
Aggregations