Class Capability<T>
java.lang.Object
net.minecraftforge.common.capabilities.Capability<T>
This is the core holder object Capabilities.
Each capability will have ONE instance of this class,
and it will the the one passed into the ICapabilityProvider functions.
The CapabilityManager is in charge of creating this class.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCapability
(String name, Capability.IStorage<T> storage, Callable<? extends T> factory) -
Method Summary
Modifier and TypeMethodDescriptionA NEW instance of the default implementation.getName()
<R> LazyOptional<R>
orEmpty
(Capability<R> toCheck, LazyOptional<T> inst) void
Quick access to the IStorage's readNBT.Quick access to the IStorage's writeNBT.
-
Field Details
-
name
-
storage
-
factory
-
-
Constructor Details
-
Capability
Capability(String name, Capability.IStorage<T> storage, Callable<? extends T> factory)
-
-
Method Details
-
getName
- Returns:
- The unique name of this capability, typically this is the fully qualified class name for the target interface.
-
getStorage
- Returns:
- An instance of the default storage handler. You can safely use this store your default implementation in NBT.
-
readNBT
Quick access to the IStorage's readNBT. SeeCapability.IStorage.readNBT(Capability, Object, EnumFacing, NBTBase)
for documentation. -
writeNBT
Quick access to the IStorage's writeNBT. SeeCapability.IStorage.writeNBT(Capability, Object, EnumFacing)
for documentation. -
getDefaultInstance
A NEW instance of the default implementation. If it important to note that if you want to use the default storage you may be required to use this exact implementation. Refer to the owning API of the Capability in question.- Returns:
- A NEW instance of the default implementation.
-
orEmpty
-