类 CapabilityDispatcher
java.lang.Object
net.minecraftforge.common.capabilities.CapabilityDispatcher
- 所有已实现的接口:
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.
-
字段概要
字段修饰符和类型字段说明private final ICapabilityProvider[]
private final String[]
private final INBTSerializable<Tag>[]
-
构造器概要
构造器构造器说明CapabilityDispatcher
(Map<ResourceLocation, ICapabilityProvider> list, List<Runnable> listeners) CapabilityDispatcher
(Map<ResourceLocation, ICapabilityProvider> list, List<Runnable> listeners, @Nullable ICapabilityProvider parent) -
方法概要
修饰符和类型方法说明void
deserializeNBT
(HolderLookup.Provider registryAccess, CompoundTag nbt) <T> LazyOptional
<T> getCapability
(Capability<T> cap, @Nullable Direction side) Retrieves the Optional handler for the capability requested on the specific side.void
serializeNBT
(HolderLookup.Provider registryAccess) 从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 net.minecraftforge.common.capabilities.ICapabilityProvider
getCapability
-
字段详细资料
-
caps
-
writers
-
names
-
listeners
-
-
构造器详细资料
-
CapabilityDispatcher
public CapabilityDispatcher(Map<ResourceLocation, ICapabilityProvider> list, List<Runnable> listeners) -
CapabilityDispatcher
public CapabilityDispatcher(Map<ResourceLocation, ICapabilityProvider> list, List<Runnable> listeners, @Nullable @Nullable ICapabilityProvider parent)
-
-
方法详细资料
-
getCapability
从接口复制的说明: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.- 指定者:
getCapability
在接口中ICapabilityProvider
- 参数:
cap
- The capability to checkside
- The Side to check from, CAN BE NULL. Null is defined to represent 'internal' or 'self'- 返回:
- The requested an optional holding the requested capability.
-
serializeNBT
- 指定者:
serializeNBT
在接口中INBTSerializable<CompoundTag>
-
deserializeNBT
- 指定者:
deserializeNBT
在接口中INBTSerializable<CompoundTag>
-
invalidate
public void invalidate()
-