public void writeToNBT(NBTTagCompound nbt) { NBTTagList list = new NBTTagList(); for (GatheringLocation location : locations) { NBTTagCompound tag = new NBTTagCompound(); location.writeToNBT(tag); list.appendTag(tag); } nbt.setTag("GatheringLocations", list); }