@ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public final class CapabilityDispatcher extends java.lang.Object implements INBTSerializable<CompoundNBT>, ICapabilityProvider
Modifier and Type | Field and Description |
---|---|
private ICapabilityProvider[] |
caps |
private java.util.List<java.lang.Runnable> |
listeners |
private java.lang.String[] |
names |
private INBTSerializable<INBT>[] |
writers |
Constructor and Description |
---|
CapabilityDispatcher(java.util.Map<ResourceLocation,ICapabilityProvider> list,
java.util.List<java.lang.Runnable> listeners) |
CapabilityDispatcher(java.util.Map<ResourceLocation,ICapabilityProvider> list,
java.util.List<java.lang.Runnable> listeners,
ICapabilityProvider parent) |
Modifier and Type | Method and Description |
---|---|
boolean |
areCompatible(CapabilityDispatcher other) |
void |
deserializeNBT(CompoundNBT nbt) |
<T> LazyOptional<T> |
getCapability(Capability<T> cap,
Direction side)
Retrieves the Optional handler for the capability requested on the specific side.
|
void |
invalidate() |
CompoundNBT |
serializeNBT() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCapability
private ICapabilityProvider[] caps
private INBTSerializable<INBT>[] writers
private java.lang.String[] names
private final java.util.List<java.lang.Runnable> listeners
public CapabilityDispatcher(java.util.Map<ResourceLocation,ICapabilityProvider> list, java.util.List<java.lang.Runnable> listeners)
public CapabilityDispatcher(java.util.Map<ResourceLocation,ICapabilityProvider> list, java.util.List<java.lang.Runnable> listeners, @Nullable ICapabilityProvider parent)
public <T> LazyOptional<T> getCapability(Capability<T> cap, @Nullable Direction side)
ICapabilityProvider
getCapability
in interface ICapabilityProvider
public CompoundNBT serializeNBT()
serializeNBT
in interface INBTSerializable<CompoundNBT>
public void deserializeNBT(CompoundNBT nbt)
deserializeNBT
in interface INBTSerializable<CompoundNBT>
public boolean areCompatible(@Nullable CapabilityDispatcher other)
public void invalidate()