类 EventListenerGroupImpl.EventListenerCollectorImpl
java.lang.Object
net.neoforged.testframework.impl.EventListenerGroupImpl.EventListenerCollectorImpl
private static final class EventListenerGroupImpl.EventListenerCollectorImpl
extends Object
implements Test.EventListenerGroup.EventListenerCollector
-
字段概要
字段修饰符和类型字段说明 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明<T extends net.neoforged.bus.api.Event>
voidaddListener
(net.neoforged.bus.api.EventPriority priority, boolean receiveCancelled, Class<T> eventType, Consumer<T> consumer) Add a consumer listener with the specifiedEventPriority
and potentially cancelled events.<T extends net.neoforged.bus.api.Event>
voidaddListener
(net.neoforged.bus.api.EventPriority priority, boolean receiveCancelled, Consumer<T> consumer) Add a consumer listener with the specifiedEventPriority
and potentially cancelled events.void
Register an instance object or a Class, and add listeners for allSubscribeEvent
annotated methods found there.void
registerAll
(net.neoforged.bus.api.IEventBus bus) Registers all the listeners added through this collector.void
unregisterAll
(net.neoforged.bus.api.IEventBus bus) Unregisters all the listeners added through this collector.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 net.neoforged.testframework.Test.EventListenerGroup.EventListenerCollector
addListener
-
字段详细资料
-
subscribeActions
-
subscribers
-
-
构造器详细资料
-
EventListenerCollectorImpl
private EventListenerCollectorImpl()
-
-
方法详细资料
-
register
Register an instance object or a Class, and add listeners for allSubscribeEvent
annotated methods found there.
Depending on what is passed as an argument, different listener creation behaviour is performed.
- Object Instance
- Scanned for non-static methods annotated with
SubscribeEvent
and creates listeners for each method found. - Class Instance
- Scanned for static methods annotated with
SubscribeEvent
and creates listeners for each method found.
- 指定者:
register
在接口中Test.EventListenerGroup.EventListenerCollector
- 参数:
object
- either aClass
instance or an arbitrary object, for scanning and event listener creation
-
addListener
public <T extends net.neoforged.bus.api.Event> void addListener(net.neoforged.bus.api.EventPriority priority, boolean receiveCancelled, Class<T> eventType, Consumer<T> consumer) Add a consumer listener with the specifiedEventPriority
and potentially cancelled events.
Use this method when one of the other methods fails to determine the concreteEvent
subclass that is intended to be subscribed to.- 指定者:
addListener
在接口中Test.EventListenerGroup.EventListenerCollector
- 类型参数:
T
- theEvent
subclass to listen for- 参数:
priority
- the priority of the listenerreceiveCancelled
- indicate if this listener should receive events that have beenICancellableEvent
cancelledeventType
- the concreteEvent
subclass to subscribe toconsumer
- callback to invoke when a matching event is received
-
addListener
public <T extends net.neoforged.bus.api.Event> void addListener(net.neoforged.bus.api.EventPriority priority, boolean receiveCancelled, Consumer<T> consumer) Add a consumer listener with the specifiedEventPriority
and potentially cancelled events.- 指定者:
addListener
在接口中Test.EventListenerGroup.EventListenerCollector
- 类型参数:
T
- theEvent
subclass to listen for- 参数:
priority
- the priority of the listenerreceiveCancelled
- indicate if this listener should receive events that have beenICancellableEvent
cancelledconsumer
- callback to invoke when a matching event is received
-
unregisterAll
public void unregisterAll(net.neoforged.bus.api.IEventBus bus) Unregisters all the listeners added through this collector.- 指定者:
unregisterAll
在接口中Test.EventListenerGroup.EventListenerCollector
- 参数:
bus
- the bus to unregister from
-
registerAll
public void registerAll(net.neoforged.bus.api.IEventBus bus) Registers all the listeners added through this collector.- 指定者:
registerAll
在接口中Test.EventListenerGroup.EventListenerCollector
- 参数:
bus
- the bus to register
-