use of cn.nukkit.item.enchantment.EnchantmentEntry in project Nukkit by Nukkit.
the class CraftingDataPacket method writeEnchantList.
private static int writeEnchantList(EnchantmentList list, BinaryStream stream) {
stream.putByte((byte) list.getSize());
for (int i = 0; i < list.getSize(); ++i) {
EnchantmentEntry entry = list.getSlot(i);
stream.putUnsignedVarInt(entry.getCost());
stream.putUnsignedVarInt(entry.getEnchantments().length);
for (Enchantment enchantment : entry.getEnchantments()) {
stream.putUnsignedVarInt(enchantment.getId());
stream.putUnsignedVarInt(enchantment.getLevel());
}
stream.putString(entry.getRandomName());
}
return CraftingDataPacket.ENTRY_ENCHANT_LIST;
}
Aggregations