use of net.minecraft.nbt.NBTTagInt in project minecolonies by Minecolonies.
the class AbstractCombinedItemHandler method serializeNBT.
@SuppressWarnings(RAWTYPES)
@Override
public NBTTagCompound serializeNBT() {
final NBTTagCompound compound = new NBTTagCompound();
int index = 0;
final NBTTagList handlerList = new NBTTagList();
final NBTTagList indexList = new NBTTagList();
for (final IItemHandlerModifiable handlerModifiable : handlers) {
if (handlerModifiable instanceof INBTSerializable) {
final INBTSerializable serializable = (INBTSerializable) handlerModifiable;
handlerList.appendTag(serializable.serializeNBT());
indexList.appendTag(new NBTTagInt(index));
}
index++;
}
compound.setTag(NBT_KEY_HANDLERS, handlerList);
if (hasCustomName()) {
compound.setString(NBT_KEY_NAME, customName);
}
return compound;
}
Aggregations