Add wrapper methods for IStorage#readNBT/writeNBT.
This commit is contained in:
parent
efa7fd4dfe
commit
70e85b5eec
1 changed files with 19 additions and 0 deletions
|
@ -65,11 +65,30 @@ public class Capability<T>
|
|||
* the fully qualified class name for the target interface.
|
||||
*/
|
||||
public String getName() { return name; }
|
||||
|
||||
/**
|
||||
* @return An instance of the default storage handler. You can safely use this store your default implementation in NBT.
|
||||
*/
|
||||
public IStorage<T> getStorage() { return storage; }
|
||||
|
||||
/**
|
||||
* Quick access to the IStorage's readNBT.
|
||||
* See {@link IStorage#readNBT(Capability, Object, EnumFacing, NBTBase)} for documentation.
|
||||
*/
|
||||
public void readNBT(T instance, EnumFacing side, NBTBase nbt)
|
||||
{
|
||||
storage.readNBT(this, instance, side, nbt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick access to the IStorage's writeNBT.
|
||||
* See {@link IStorage#writeNBT(Capability, Object, EnumFacing)} for documentation.
|
||||
*/
|
||||
public NBTBase writeNBT(T instance, EnumFacing side)
|
||||
{
|
||||
return storage.writeNBT(this, instance, side);
|
||||
}
|
||||
|
||||
/**
|
||||
* A NEW instance of the default implementation.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue