コード例 #1
0
 @Override
 public void writeToNBT(NBTTagCompound compound) {
   super.writeToNBT(compound);
   if (customTitle != null) compound.setString("CustomName", customTitle);
   if (contents != null) compound.setTag("Items", NbtUtils.writeItems(contents));
   if (hasComparatorAccessed()) compound.setBoolean("ComparatorAccessed", true);
 }
コード例 #2
0
 @Override
 public void readFromNBT(NBTTagCompound compound) {
   super.readFromNBT(compound);
   if (compound.hasKey("CustomName")) customTitle = compound.getString("CustomName");
   if (contents != null) NbtUtils.readItems(contents, compound.getTagList("Items"));
   if (compound.getBoolean("ComparatorAccessed")) compAccessedOnLoad = true;
 }