use of org.lanternpowered.server.network.buffer.ByteBuffer in project LanternServer by LanternPowered.
the class CodecPlayOutEntityHeadLook method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutEntityHeadLook message) throws CodecException {
final ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeVarInt(message.getEntityId());
buf.writeByte(message.getYaw());
return buf;
}
use of org.lanternpowered.server.network.buffer.ByteBuffer in project LanternServer by LanternPowered.
the class CodecPlayOutEntityLook method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutEntityLook message) throws CodecException {
final ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeVarInt(message.getEntityId());
buf.writeByte(message.getYaw());
buf.writeByte(message.getPitch());
buf.writeBoolean(message.isOnGround());
return buf;
}
use of org.lanternpowered.server.network.buffer.ByteBuffer in project LanternServer by LanternPowered.
the class CodecPlayOutEntityMetadata method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutEntityMetadata message) throws CodecException {
final ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeVarInt(message.getEntityId());
((AbstractParameterList) message.getParameterList()).write(buf);
return buf;
}
use of org.lanternpowered.server.network.buffer.ByteBuffer in project LanternServer by LanternPowered.
the class CodecPlayOutEntityRelativeMove method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutEntityRelativeMove message) throws CodecException {
ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeVarInt(message.getEntityId());
buf.writeShort((short) message.getDeltaX());
buf.writeShort((short) message.getDeltaY());
buf.writeShort((short) message.getDeltaZ());
buf.writeBoolean(message.isOnGround());
return buf;
}
use of org.lanternpowered.server.network.buffer.ByteBuffer in project LanternServer by LanternPowered.
the class CodecPlayOutEntityVelocity method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutEntityVelocity message) throws CodecException {
ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeVarInt(message.getEntityId());
buf.writeShort((short) Math.min(message.getX() * 8000.0, Short.MAX_VALUE));
buf.writeShort((short) Math.min(message.getY() * 8000.0, Short.MAX_VALUE));
buf.writeShort((short) Math.min(message.getZ() * 8000.0, Short.MAX_VALUE));
return buf;
}
Aggregations