blob: 946c39e82abe4b15820c6f347da451360d05b73e [file] [log] [blame] [raw]
package li.cil.oc.api
import net.minecraft.nbt.NBTTagCompound
/**
* An object that can be persisted to an NBT tag and restored back from it.
*/
trait Persistable {
/**
* Restores a previous state of the object from the specified NBT tag.
*
* @param nbt the tag to read the state from.
*/
def readFromNBT(nbt: NBTTagCompound) {}
/**
* Saves the current state of the object into the specified NBT tag.
* <p/>
* This should write the state in such a way that it can be restored when
* `load` is called with that tag.
*
* @param nbt the tag to save the state to.
*/
def writeToNBT(nbt: NBTTagCompound) {}
}