use of net.glowstone.advancement.GlowAdvancement in project Glowstone by GlowstoneMC.
the class AdvancementsCodec method encode.
@Override
public ByteBuf encode(ByteBuf buf, AdvancementsMessage message) throws IOException {
buf.writeBoolean(message.isClear());
ByteBufUtils.writeVarInt(buf, message.getAdvancements().size());
for (NamespacedKey key : message.getAdvancements().keySet()) {
ByteBufUtils.writeUTF8(buf, key.toString());
GlowAdvancement advancement = (GlowAdvancement) message.getAdvancements().get(key);
advancement.encode(buf);
}
ByteBufUtils.writeVarInt(buf, message.getRemoveAdvancements().size());
for (NamespacedKey key : message.getRemoveAdvancements()) {
ByteBufUtils.writeUTF8(buf, key.toString());
}
// todo: progress
ByteBufUtils.writeVarInt(buf, 0);
return buf;
}
Aggregations