Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Write:
- NBTTagList furnacesTagList = new NBTTagList();
- for (Map.Entry<BlockPos, BakingProduct> entry : furnaces.entrySet())
- {
- NBTTagCompound furnaceCompound = new NBTTagCompound();
- BlockPosUtil.writeToNBT(furnaceCompound, TAG_FURNACE_POS, entry.getKey());
- if(entry.getValue() != null)
- {
- entry.getValue().writeToNBT(furnaceCompound);
- }
- furnacesTagList.appendTag(furnaceCompound);
- }
- compound.setTag(TAG_FURNACES, furnacesTagList);
- Read:
- final NBTTagList furnaceTagList = compound.getTagList(TAG_FURNACES, Constants.NBT.TAG_COMPOUND);
- for (int i = 0; i < furnaceTagList.tagCount(); ++i)
- {
- final NBTTagCompound furnaceCompound = furnaceTagList.getCompoundTagAt(i);
- final BlockPos pos = BlockPosUtil.readFromNBT(furnaceCompound, TAG_FURNACE_POS);
- final BakingProduct bakingProduct = BakingProduct.createFromNBT(furnaceCompound);
- furnaces.put(pos, bakingProduct);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement