Class CapabilityProvider<B extends CapabilityProvider<B>>
java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<B>
- All Implemented Interfaces:
ICapabilityProvider
- Direct Known Subclasses:
Chunk
,Entity
,ItemStack
,TileEntity
,World
@MethodsReturnNonnullByDefault
@ParametersAreNonnullByDefault
public abstract class CapabilityProvider<B extends CapabilityProvider<B>>
extends Object
implements ICapabilityProvider
-
Field Summary
Modifier and TypeFieldDescriptionprivate CapabilityDispatcher
private boolean
private boolean
private CompoundNBT
private Supplier<ICapabilityProvider>
(package private) static boolean
private boolean
-
Constructor Summary
ModifierConstructorDescriptionprotected
CapabilityProvider
(Class<B> baseClass) protected
CapabilityProvider
(Class<B> baseClass, boolean isLazy) -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
final boolean
areCapsCompatible
(CapabilityProvider<B> other) protected final void
private void
protected final void
protected final void
protected final void
protected final CapabilityDispatcher
<T> LazyOptional<T>
getCapability
(Capability<T> cap, Direction side) Retrieves the Optional handler for the capability requested on the specific side.protected void
protected void
protected final CompoundNBT
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapability
-
Field Details
-
SUPPORTS_LAZY_CAPABILITIES
static boolean SUPPORTS_LAZY_CAPABILITIES -
baseClass
-
capabilities
-
valid
private boolean valid -
isLazy
private boolean isLazy -
lazyParentSupplier
-
lazyData
-
initialized
private boolean initialized
-
-
Constructor Details
-
CapabilityProvider
-
CapabilityProvider
-
-
Method Details
-
gatherCapabilities
protected final void gatherCapabilities() -
gatherCapabilities
-
gatherCapabilities
-
doGatherCapabilities
-
getCapabilities
-
areCapsCompatible
-
areCapsCompatible
-
serializeCaps
-
deserializeCaps
-
invalidateCaps
protected void invalidateCaps() -
reviveCaps
protected void reviveCaps() -
getCapability
@Nonnull public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) Description copied from interface:ICapabilityProvider
Retrieves the Optional handler for the capability requested on the specific side. The return value CAN be the same for multiple faces. Modders are encouraged to cache this value, using the listener capabilities of the Optional to be notified if the requested capability get lost.- Specified by:
getCapability
in interfaceICapabilityProvider
- Returns:
- The requested an optional holding the requested capability.
-