Advertisement
Guest User

Untitled

a guest
Oct 1st, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1.  
  2. Write:
  3. NBTTagList furnacesTagList = new NBTTagList();
  4. for (Map.Entry<BlockPos, BakingProduct> entry : furnaces.entrySet())
  5. {
  6. NBTTagCompound furnaceCompound = new NBTTagCompound();
  7. BlockPosUtil.writeToNBT(furnaceCompound, TAG_FURNACE_POS, entry.getKey());
  8.  
  9. if(entry.getValue() != null)
  10. {
  11. entry.getValue().writeToNBT(furnaceCompound);
  12. }
  13.  
  14. furnacesTagList.appendTag(furnaceCompound);
  15. }
  16. compound.setTag(TAG_FURNACES, furnacesTagList);
  17.  
  18.  
  19. Read:
  20.  
  21. final NBTTagList furnaceTagList = compound.getTagList(TAG_FURNACES, Constants.NBT.TAG_COMPOUND);
  22. for (int i = 0; i < furnaceTagList.tagCount(); ++i)
  23. {
  24. final NBTTagCompound furnaceCompound = furnaceTagList.getCompoundTagAt(i);
  25. final BlockPos pos = BlockPosUtil.readFromNBT(furnaceCompound, TAG_FURNACE_POS);
  26. final BakingProduct bakingProduct = BakingProduct.createFromNBT(furnaceCompound);
  27. furnaces.put(pos, bakingProduct);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement