writeToNBT and readFromNBT base