use of net.glowstone.net.message.play.entity.SpawnPlayerMessage in project Glowstone by GlowstoneMC.
the class GlowHumanEntity method createSpawnMessage.
////////////////////////////////////////////////////////////////////////////
// Internals
@Override
public List<Message> createSpawnMessage() {
List<Message> result = new LinkedList<>();
// spawn player
double x = location.getX();
double y = location.getY();
double z = location.getZ();
int yaw = Position.getIntYaw(location);
int pitch = Position.getIntPitch(location);
result.add(new SpawnPlayerMessage(id, profile.getUniqueId(), x, y, z, yaw, pitch, metadata.getEntryList()));
// head facing
result.add(new EntityHeadRotationMessage(id, yaw));
// equipment
EntityEquipment equipment = getEquipment();
result.add(new EntityEquipmentMessage(id, 0, equipment.getItemInHand()));
for (int i = 0; i < 4; i++) {
result.add(new EntityEquipmentMessage(id, i + 1, equipment.getArmorContents()[i]));
}
return result;
}
use of net.glowstone.net.message.play.entity.SpawnPlayerMessage in project Glowstone by GlowstoneMC.
the class SpawnPlayerCodec method decode.
@Override
public SpawnPlayerMessage decode(ByteBuf buf) throws IOException {
int id = ByteBufUtils.readVarInt(buf);
UUID uuid = GlowBufUtils.readUuid(buf);
double x = buf.readDouble();
double y = buf.readDouble();
double z = buf.readDouble();
int rotation = buf.readByte();
int pitch = buf.readByte();
List<Entry> list = GlowBufUtils.readMetadata(buf);
return new SpawnPlayerMessage(id, uuid, x, y, z, rotation, pitch, list);
}
Aggregations