use of net.glowstone.net.message.play.entity.EntityHeadRotationMessage in project Glowstone by GlowstoneMC.
the class GlowLivingEntity method createUpdateMessage.
@Override
public List<Message> createUpdateMessage() {
List<Message> messages = super.createUpdateMessage();
messages.addAll(equipmentMonitor.getChanges().stream().map(change -> new EntityEquipmentMessage(id, change.slot, change.item)).collect(Collectors.toList()));
if (headRotated) {
messages.add(new EntityHeadRotationMessage(id, Position.getIntHeadYaw(headYaw)));
headRotated = false;
}
attributeManager.applyMessages(messages);
return messages;
}
use of net.glowstone.net.message.play.entity.EntityHeadRotationMessage in project Glowstone by GlowstoneMC.
the class GlowBat method createSpawnMessage.
@Override
public List<Message> createSpawnMessage() {
List<Message> result = new LinkedList<>();
result.add(new SpawnMobMessage(entityId, getUniqueId(), EntityNetworkUtil.getMobId(EntityType.BAT), location, metadata.getEntryList()));
// head facing
result.add(new EntityHeadRotationMessage(entityId, Position.getIntYaw(location)));
return result;
}
use of net.glowstone.net.message.play.entity.EntityHeadRotationMessage in project Glowstone by GlowstoneMC.
the class GlowCreature method createSpawnMessage.
@Override
public List<Message> createSpawnMessage() {
List<Message> result = new LinkedList<>();
// spawn mob
result.add(new SpawnMobMessage(entityId, getUniqueId(), EntityNetworkUtil.getMobId(type), location, metadata.getEntryList()));
// head facing
result.add(new EntityHeadRotationMessage(entityId, Position.getIntYaw(location)));
// result.add(createEquipmentMessage());
return result;
}
use of net.glowstone.net.message.play.entity.EntityHeadRotationMessage 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(entityId, profile.getId(), x, y, z, yaw, pitch, metadata.getEntryList()));
// head facing
result.add(new EntityHeadRotationMessage(entityId, yaw));
// equipment
EntityEquipment equipment = getEquipment();
result.add(new EntityEquipmentMessage(entityId, EntityEquipmentMessage.HELD_ITEM, equipment.getItemInMainHand()));
result.add(new EntityEquipmentMessage(entityId, EntityEquipmentMessage.OFF_HAND, equipment.getItemInOffHand()));
for (int i = 0; i < 4; i++) {
result.add(new EntityEquipmentMessage(entityId, EntityEquipmentMessage.BOOTS_SLOT + i, equipment.getArmorContents()[i]));
}
return result;
}
use of net.glowstone.net.message.play.entity.EntityHeadRotationMessage in project Glowstone by GlowstoneMC.
the class GlowLivingEntity method createUpdateMessage.
@Override
public List<Message> createUpdateMessage(GlowSession session) {
List<Message> messages = super.createUpdateMessage(session);
messages.addAll(equipmentMonitor.getChanges().stream().map(change -> new EntityEquipmentMessage(entityId, change.slot, change.item)).collect(Collectors.toList()));
if (headRotated) {
messages.add(new EntityHeadRotationMessage(entityId, Position.getIntHeadYaw(headYaw)));
}
attributeManager.applyMessages(messages);
return messages;
}
Aggregations