Search in sources :

Example 1 with EntityHeadRotationMessage

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;
}
Also used : EntityHeadRotationMessage(net.glowstone.net.message.play.entity.EntityHeadRotationMessage) EntityEquipmentMessage(net.glowstone.net.message.play.entity.EntityEquipmentMessage) Message(com.flowpowered.network.Message) EntityRemoveEffectMessage(net.glowstone.net.message.play.entity.EntityRemoveEffectMessage) EntityHeadRotationMessage(net.glowstone.net.message.play.entity.EntityHeadRotationMessage) EntityEffectMessage(net.glowstone.net.message.play.entity.EntityEffectMessage) EntityEquipmentMessage(net.glowstone.net.message.play.entity.EntityEquipmentMessage)

Example 2 with EntityHeadRotationMessage

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;
}
Also used : SpawnMobMessage(net.glowstone.net.message.play.entity.SpawnMobMessage) EntityHeadRotationMessage(net.glowstone.net.message.play.entity.EntityHeadRotationMessage) Message(com.flowpowered.network.Message) SpawnMobMessage(net.glowstone.net.message.play.entity.SpawnMobMessage) EntityHeadRotationMessage(net.glowstone.net.message.play.entity.EntityHeadRotationMessage) LinkedList(java.util.LinkedList)

Example 3 with EntityHeadRotationMessage

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;
}
Also used : SpawnMobMessage(net.glowstone.net.message.play.entity.SpawnMobMessage) EntityHeadRotationMessage(net.glowstone.net.message.play.entity.EntityHeadRotationMessage) Message(com.flowpowered.network.Message) SpawnMobMessage(net.glowstone.net.message.play.entity.SpawnMobMessage) EntityHeadRotationMessage(net.glowstone.net.message.play.entity.EntityHeadRotationMessage) LinkedList(java.util.LinkedList)

Example 4 with EntityHeadRotationMessage

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;
}
Also used : EntityHeadRotationMessage(net.glowstone.net.message.play.entity.EntityHeadRotationMessage) SpawnPlayerMessage(net.glowstone.net.message.play.entity.SpawnPlayerMessage) EntityHeadRotationMessage(net.glowstone.net.message.play.entity.EntityHeadRotationMessage) SpawnPlayerMessage(net.glowstone.net.message.play.entity.SpawnPlayerMessage) EntityEquipmentMessage(net.glowstone.net.message.play.entity.EntityEquipmentMessage) Message(com.flowpowered.network.Message) EntityEquipment(org.bukkit.inventory.EntityEquipment) EntityEquipmentMessage(net.glowstone.net.message.play.entity.EntityEquipmentMessage) LinkedList(java.util.LinkedList)

Example 5 with EntityHeadRotationMessage

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;
}
Also used : EntityHeadRotationMessage(net.glowstone.net.message.play.entity.EntityHeadRotationMessage) EntityRemoveEffectMessage(net.glowstone.net.message.play.entity.EntityRemoveEffectMessage) Message(com.flowpowered.network.Message) InteractEntityMessage(net.glowstone.net.message.play.player.InteractEntityMessage) EntityHeadRotationMessage(net.glowstone.net.message.play.entity.EntityHeadRotationMessage) CollectItemMessage(net.glowstone.net.message.play.entity.CollectItemMessage) EntityEffectMessage(net.glowstone.net.message.play.entity.EntityEffectMessage) EntityEquipmentMessage(net.glowstone.net.message.play.entity.EntityEquipmentMessage) EntityAnimationMessage(net.glowstone.net.message.play.entity.EntityAnimationMessage) EntityEquipmentMessage(net.glowstone.net.message.play.entity.EntityEquipmentMessage)

Aggregations

Message (com.flowpowered.network.Message)5 EntityHeadRotationMessage (net.glowstone.net.message.play.entity.EntityHeadRotationMessage)5 LinkedList (java.util.LinkedList)3 EntityEquipmentMessage (net.glowstone.net.message.play.entity.EntityEquipmentMessage)3 EntityEffectMessage (net.glowstone.net.message.play.entity.EntityEffectMessage)2 EntityRemoveEffectMessage (net.glowstone.net.message.play.entity.EntityRemoveEffectMessage)2 SpawnMobMessage (net.glowstone.net.message.play.entity.SpawnMobMessage)2 CollectItemMessage (net.glowstone.net.message.play.entity.CollectItemMessage)1 EntityAnimationMessage (net.glowstone.net.message.play.entity.EntityAnimationMessage)1 SpawnPlayerMessage (net.glowstone.net.message.play.entity.SpawnPlayerMessage)1 InteractEntityMessage (net.glowstone.net.message.play.player.InteractEntityMessage)1 EntityEquipment (org.bukkit.inventory.EntityEquipment)1