@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); }
@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; }