Search in sources :

Example 1 with SpawnMobMessage

use of net.glowstone.net.message.play.entity.SpawnMobMessage in project Glowstone by GlowstoneMC.

the class GlowBat method createSpawnMessage.

@Override
public List<Message> createSpawnMessage() {
    List<Message> result = new LinkedList<>();
    // spawn mob
    double x = location.getX();
    double y = location.getY();
    double z = location.getZ();
    int yaw = Position.getIntYaw(location);
    int pitch = Position.getIntPitch(location);
    //TODO 1.9 - Real UUID
    result.add(new SpawnMobMessage(id, UUID.randomUUID(), getType().getTypeId(), x, y, z, yaw, pitch, pitch, 0, 0, 0, metadata.getEntryList()));
    // head facing
    result.add(new EntityHeadRotationMessage(id, yaw));
    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 2 with SpawnMobMessage

use of net.glowstone.net.message.play.entity.SpawnMobMessage in project Glowstone by GlowstoneMC.

the class GlowCreature method createSpawnMessage.

@Override
public List<Message> createSpawnMessage() {
    List<Message> result = new LinkedList<>();
    // spawn mob
    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 SpawnMobMessage(id, getUniqueId(), type.getTypeId(), x, y, z, yaw, pitch, pitch, 0, 0, 0, metadata.getEntryList()));
    // head facing
    result.add(new EntityHeadRotationMessage(id, yaw));
    //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) EntityHeadRotationMessage(net.glowstone.net.message.play.entity.EntityHeadRotationMessage) SpawnMobMessage(net.glowstone.net.message.play.entity.SpawnMobMessage) LinkedList(java.util.LinkedList)

Example 3 with SpawnMobMessage

use of net.glowstone.net.message.play.entity.SpawnMobMessage in project Glowstone by GlowstoneMC.

the class SpawnMobCodec method decode.

@Override
public SpawnMobMessage decode(ByteBuf buf) throws IOException {
    int id = ByteBufUtils.readVarInt(buf);
    UUID uuid = GlowBufUtils.readUuid(buf);
    int type = ByteBufUtils.readVarInt(buf);
    ;
    double x = buf.readDouble();
    double y = buf.readDouble();
    double z = buf.readDouble();
    int headPitch = buf.readByte();
    int pitch = buf.readByte();
    int rotation = buf.readByte();
    int velX = buf.readShort();
    int velY = buf.readShort();
    int velZ = buf.readShort();
    List<Entry> list = GlowBufUtils.readMetadata(buf);
    return new SpawnMobMessage(id, uuid, type, x, y, z, rotation, pitch, headPitch, velX, velY, velZ, list);
}
Also used : SpawnMobMessage(net.glowstone.net.message.play.entity.SpawnMobMessage) Entry(net.glowstone.entity.meta.MetadataMap.Entry) UUID(java.util.UUID)

Aggregations

SpawnMobMessage (net.glowstone.net.message.play.entity.SpawnMobMessage)3 Message (com.flowpowered.network.Message)2 LinkedList (java.util.LinkedList)2 EntityHeadRotationMessage (net.glowstone.net.message.play.entity.EntityHeadRotationMessage)2 UUID (java.util.UUID)1 Entry (net.glowstone.entity.meta.MetadataMap.Entry)1