本文整理汇总了Java中org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityPositionPacket类的典型用法代码示例。如果您正苦于以下问题:Java ServerEntityPositionPacket类的具体用法?Java ServerEntityPositionPacket怎么用?Java ServerEntityPositionPacket使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServerEntityPositionPacket类属于org.spacehq.mc.protocol.packet.ingame.server.entity包,在下文中一共展示了ServerEntityPositionPacket类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUpdatePackets
import org.spacehq.mc.protocol.packet.ingame.server.entity.ServerEntityPositionPacket; //导入依赖的package包/类
public List<Packet> getUpdatePackets() {
// From Glowstone. Thanks dudes :D
List<Packet> list = new CopyOnWriteArrayList<Packet>();
double moveX = getLocation().getX() - prevLoc.getX();
double moveY = getLocation().getY() - prevLoc.getY();
double moveZ = getLocation().getZ() - prevLoc.getZ();
if (teleported || teleported && moved) {
list.add(new ServerEntityTeleportPacket(getEntityID(), getLocation().getX(), getLocation().getY(), getLocation().getZ(), getLocation().getYaw(), getLocation().getPitch(), onGround()));
this.teleported = false;
this.moved = false;
} else if (moved && rotated) {
list.add(new ServerEntityPositionRotationPacket(getEntityID(), moveX, moveY, moveZ, getLocation().getYaw(), getLocation().getPitch(), onGround()));
this.moved = false;
this.rotated = false;
} else if (moved) {
list.add(new ServerEntityPositionPacket(getEntityID(), moveX, moveY, moveZ, onGround()));
this.moved = false;
} else if (rotated) {
list.add(new ServerEntityRotationPacket(getEntityID(), getLocation().getYaw(), getLocation().getPitch(), onGround()));
this.rotated = false;
}
// TODO: Head update
// list.add(new ServerEntityHeadLookPacket(getEntityID(),
// getLocation().getYaw()));
// TODO: Metadata
list.add(new ServerEntityMetadataPacket(getEntityID(), ((CyanMetadataMap) metadata).getMetaArray()));
return list;
}