Merge pull request #2664 from gigaherz/capability-storage

Make access to the Capability IStorage less annoying
This commit is contained in:
LexManos 2016-03-30 16:00:47 -07:00
commit 82f964c00d
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.