类 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.
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明addListener
(Consumer<Capability<T>> listener) Adds a listener to be called when someone registers this capability.getName()
boolean
(专用程序包) void
<R> @NotNull LazyOptional
<R> orEmpty
(Capability<R> toCheck, LazyOptional<T> inst)
-
字段详细资料
-
name
-
listeners
List<Consumer<Capability<T>>> listeners
-
-
构造器详细资料
-
Capability
Capability(String name)
-
-
方法详细资料
-
getName
- 返回:
- The unique name of this capability, typically this is the fully qualified class name for the target interface.
-
orEmpty
-
isRegistered
public boolean isRegistered()- 返回:
- true if something has registered this capability to the Manager. This is a marker that the class for this capability exists, and can be used.
-
addListener
Adds a listener to be called when someone registers this capability. May be called instantly if this is already registered.- 参数:
listener
- Function to fire when capability is registered.- 返回:
- self, in case people want to use builder pattern.
-
onRegister
void onRegister()
-