Reference
EymistakenHudEventBus
Lets addons react to things happening inside the HUD.
Members
static EymistakenHudEventBus getInstance()since 1.2.0The one bus.
<T> void subscribe(Class<T> type, Consumer<? super T> handler)since 1.2.0Listens for one event type. Safe to call at any point after client init. A null type or handler is ignored.
<T> void emit(T event)since 1.2.0Delivers an event to every subscriber of its exact class. A null event is ignored.
How dispatch works
| Exact class | Subscribing to a supertype does not receive subclasses. |
|---|---|
| Client thread | Handlers run on the client thread, inline with whatever caused the event, so keep them short. |
| Failures | A handler that throws is logged and skipped. It never takes the rest of the mod down with it. |
| Subscribing mid-dispatch | Safe. The handler list is copy-on-write, so a handler that subscribes while an event is being delivered cannot break the loop that is running. |