use of org.lanternpowered.server.network.buffer.ByteBuffer in project LanternServer by LanternPowered.
the class CodecPlayOutRemovePotionEffect method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutRemovePotionEffect message) throws CodecException {
final ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeVarInt(message.getEntityId());
buf.writeByte((byte) ((LanternPotionEffectType) message.getType()).getInternalId());
return buf;
}
use of org.lanternpowered.server.network.buffer.ByteBuffer in project LanternServer by LanternPowered.
the class CodecPlayOutScoreboardObjective method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutScoreboardObjective message) throws CodecException {
ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeString(message.getObjectiveName());
if (message instanceof MessagePlayOutScoreboardObjective.CreateOrUpdate) {
buf.writeByte((byte) (message instanceof MessagePlayOutScoreboardObjective.Create ? 0 : 2));
MessagePlayOutScoreboardObjective.CreateOrUpdate message0 = (MessagePlayOutScoreboardObjective.CreateOrUpdate) message;
buf.writeString(message0.getDisplayName());
buf.writeString(message0.getDisplayMode().getId());
} else {
buf.writeByte((byte) 1);
}
return buf;
}
use of org.lanternpowered.server.network.buffer.ByteBuffer in project LanternServer by LanternPowered.
the class CodecPlayOutSendResourcePack method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutSendResourcePack message) throws CodecException {
ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeString(message.getUrl());
buf.writeString(message.getHash());
return buf;
}
use of org.lanternpowered.server.network.buffer.ByteBuffer in project LanternServer by LanternPowered.
the class CodecPlayOutSetCooldown method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutSetCooldown message) throws CodecException {
ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeVarInt(message.getItemType());
buf.writeVarInt(message.getCooldownTicks());
return buf;
}
use of org.lanternpowered.server.network.buffer.ByteBuffer in project LanternServer by LanternPowered.
the class CodecPlayOutSetEntityPassengers method encode.
@Override
public ByteBuffer encode(CodecContext context, MessagePlayOutSetEntityPassengers message) throws CodecException {
final ByteBuffer buf = context.byteBufAlloc().buffer();
buf.writeVarInt(message.getEntityId());
final int[] passengersIds = message.getPassengersIds();
buf.writeVarInt(passengersIds.length);
for (int entityId : passengersIds) {
buf.writeVarInt(entityId);
}
return buf;
}
Aggregations