@MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public abstract class CapabilityProvider<B extends CapabilityProvider<B>> extends java.lang.Object implements ICapabilityProvider
Modifier and Type | Field and Description |
---|---|
private java.lang.Class<B> |
baseClass |
private CapabilityDispatcher |
capabilities |
private boolean |
valid |
Modifier | Constructor and Description |
---|---|
protected |
CapabilityProvider(java.lang.Class<B> baseClass) |
Modifier and Type | Method and Description |
---|---|
boolean |
areCapsCompatible(CapabilityDispatcher other) |
boolean |
areCapsCompatible(CapabilityProvider<B> other) |
protected void |
deserializeCaps(CompoundNBT tag) |
protected void |
gatherCapabilities() |
protected void |
gatherCapabilities(ICapabilityProvider parent) |
protected CapabilityDispatcher |
getCapabilities() |
<T> LazyOptional<T> |
getCapability(Capability<T> cap,
Direction side)
Retrieves the Optional handler for the capability requested on the specific side.
|
protected void |
invalidateCaps() |
protected void |
reviveCaps() |
protected CompoundNBT |
serializeCaps() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCapability
@Nonnull private final java.lang.Class<B extends CapabilityProvider<B>> baseClass
@Nullable private CapabilityDispatcher capabilities
private boolean valid
protected CapabilityProvider(java.lang.Class<B> baseClass)
protected final void gatherCapabilities()
protected final void gatherCapabilities(@Nullable ICapabilityProvider parent)
@Nullable protected final CapabilityDispatcher getCapabilities()
public final boolean areCapsCompatible(CapabilityProvider<B> other)
public final boolean areCapsCompatible(@Nullable CapabilityDispatcher other)
@Nullable protected final CompoundNBT serializeCaps()
protected final void deserializeCaps(CompoundNBT tag)
protected void invalidateCaps()
protected void reviveCaps()
@Nonnull public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side)
ICapabilityProvider
getCapability
in interface ICapabilityProvider