Class CapabilityDispatcher
java.lang.Object
net.minecraftforge.common.capabilities.CapabilityDispatcher
- All Implemented Interfaces:
- ICapabilityProvider,- INBTSerializable<CompoundTag>
@ParametersAreNonnullByDefault
public final class CapabilityDispatcher
extends Object
implements INBTSerializable<CompoundTag>, ICapabilityProvider
A high-speed implementation of a capability delegator.
 This is used to wrap the results of the AttachCapabilitiesEvent.
 It is HIGHLY recommended that you DO NOT use this approach unless
 you MUST delegate to multiple providers instead just implement y
 our handlers using normal if statements.
 Internally the handlers are baked into arrays for fast iteration.
 The ResourceLocations will be used for the NBT Key when serializing.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate ICapabilityProvider[]private String[]private INBTSerializable<Tag>[]
- 
Constructor SummaryConstructorsConstructorDescriptionCapabilityDispatcher(Map<ResourceLocation, ICapabilityProvider> list, List<Runnable> listeners) CapabilityDispatcher(Map<ResourceLocation, ICapabilityProvider> list, List<Runnable> listeners, @Nullable ICapabilityProvider parent) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleanareCompatible(@Nullable CapabilityDispatcher other) void<T> LazyOptional<T>getCapability(Capability<T> cap, @Nullable Direction side) Retrieves the Optional handler for the capability requested on the specific side.voidMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvidergetCapability
- 
Field Details- 
caps
- 
writers
- 
names
- 
listeners
 
- 
- 
Constructor Details- 
CapabilityDispatcherpublic CapabilityDispatcher(Map<ResourceLocation, ICapabilityProvider> list, List<Runnable> listeners) 
- 
CapabilityDispatcherpublic CapabilityDispatcher(Map<ResourceLocation, ICapabilityProvider> list, List<Runnable> listeners, @Nullable @Nullable ICapabilityProvider parent) 
 
- 
- 
Method Details- 
getCapabilityDescription copied from interface:ICapabilityProviderRetrieves 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:
- getCapabilityin interface- ICapabilityProvider
- Parameters:
- cap- The capability to check
- side- The Side to check from, CAN BE NULL. Null is defined to represent 'internal' or 'self'
- Returns:
- The requested an optional holding the requested capability.
 
- 
serializeNBT- Specified by:
- serializeNBTin interface- INBTSerializable<CompoundTag>
 
- 
deserializeNBT- Specified by:
- deserializeNBTin interface- INBTSerializable<CompoundTag>
 
- 
areCompatible
- 
invalidatepublic void invalidate()
 
-