Interface Events
public interface Events
Registration of event listeners. Listeners of one event run in registration order. A listener
that throws is logged with the mod's id; one that throws repeatedly is removed.
-
Method Summary
Modifier and TypeMethodDescription<E extends Event>
Subscriptionlistenerruns on the main thread while the event is posted.<E extends Event>
SubscriptiononModThread(Class<E> type, Consumer<? super E> listener) listenerruns later on the mod's own thread.
-
Method Details
-
onMain
listenerruns on the main thread while the event is posted. It may touch game objects and must return quickly: it runs inside the tick. -
onModThread
listenerruns later on the mod's own thread. It must not touch game objects; main-thread work goes throughmain().- Throws:
IllegalArgumentException- whentypeis aMainThreadEvent
-