public class Capability<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Capability.IStorage<T> |
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.Callable<? extends T> |
factory |
private java.lang.String |
name |
private Capability.IStorage<T> |
storage |
Constructor and Description |
---|
Capability(java.lang.String name,
Capability.IStorage<T> storage,
java.util.concurrent.Callable<? extends T> factory) |
Modifier and Type | Method and Description |
---|---|
T |
getDefaultInstance()
A NEW instance of the default implementation.
|
java.lang.String |
getName() |
Capability.IStorage<T> |
getStorage() |
<R> LazyOptional<R> |
orEmpty(Capability<R> toCheck,
LazyOptional<T> inst) |
void |
readNBT(T instance,
Direction side,
INBT nbt)
Quick access to the IStorage's readNBT.
|
INBT |
writeNBT(T instance,
Direction side)
Quick access to the IStorage's writeNBT.
|
private final java.lang.String name
private final Capability.IStorage<T> storage
private final java.util.concurrent.Callable<? extends T> factory
Capability(java.lang.String name, Capability.IStorage<T> storage, java.util.concurrent.Callable<? extends T> factory)
public java.lang.String getName()
public Capability.IStorage<T> getStorage()
public void readNBT(T instance, Direction side, INBT nbt)
IStorage#readNBT(Capability, Object, EnumFacing, NBTBase)
for documentation.@Nullable public INBT writeNBT(T instance, Direction side)
IStorage#writeNBT(Capability, Object, EnumFacing)
for documentation.@Nullable public T getDefaultInstance()
@Nonnull public <R> LazyOptional<R> orEmpty(Capability<R> toCheck, LazyOptional<T> inst)