Add wrapper methods for IStorage#readNBT/writeNBT.

This commit is contained in:
gigaherz 2016-03-28 18:22:42 +02:00
parent efa7fd4dfe
commit 70e85b5eec
1 changed files with 19 additions and 0 deletions

View File

@ -65,10 +65,29 @@ 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.