Search in sources :

Example 1 with GlowAdvancement

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;
}
Also used : NamespacedKey(org.bukkit.NamespacedKey) GlowAdvancement(net.glowstone.advancement.GlowAdvancement)

Aggregations

GlowAdvancement (net.glowstone.advancement.GlowAdvancement)1 NamespacedKey (org.bukkit.NamespacedKey)1