类 AttachCapabilitiesEvent<T>
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.GenericEvent<T>
net.minecraftforge.event.AttachCapabilitiesEvent<T>
- 所有已实现的接口:
net.minecraftforge.eventbus.api.IGenericEvent<T>
public class AttachCapabilitiesEvent<T>
extends net.minecraftforge.eventbus.api.GenericEvent<T>
Fired whenever an object with Capabilities support {currently TileEntity/Item/Entity)
is created. Allowing for the attachment of arbitrary capability providers.
Please note that as this is fired for ALL object creations efficient code is recommended.
And if possible use one of the sub-classes to filter your intended objects.
-
嵌套类概要
从类继承的嵌套类/接口 net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
字段概要
字段修饰符和类型字段说明private final Map
<ResourceLocation, ICapabilityProvider> private final T
private final Map
<ResourceLocation, ICapabilityProvider> -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
addCapability
(ResourceLocation key, ICapabilityProvider cap) Adds a capability to be attached to this object.void
addListener
(Runnable listener) Adds a callback that is fired when the attached object is invalidated.A unmodifiable view of the capabilities that will be attached to this object.Retrieves the object that is being created, Not much state is set.从类继承的方法 net.minecraftforge.eventbus.api.GenericEvent
getGenericType
从类继承的方法 net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
字段详细资料
-
obj
-
caps
-
view
-
listeners
-
listenersView
-
-
构造器详细资料
-
AttachCapabilitiesEvent
-
-
方法详细资料
-
getObject
Retrieves the object that is being created, Not much state is set. -
addCapability
Adds a capability to be attached to this object. Keys MUST be unique, it is suggested that you set the domain to your mod ID. If the capability is an instance of INBTSerializable, this key will be used when serializing this capability.- 参数:
key
- The name of owner of this capability provider.cap
- The capability provider
-
getCapabilities
A unmodifiable view of the capabilities that will be attached to this object. -
addListener
Adds a callback that is fired when the attached object is invalidated. Such as a Entity/TileEntity being removed from world. All attached providers should invalidate all of their held capability instances. -
getListeners
-