Package com.minecolonies.api.eventbus
Interface EventBus
- All Known Implementing Classes:
DefaultEventBus
public interface EventBus
Interface for the mod event bus.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceEventBus.EventHandler<T extends IModEvent>The event handler lambda definition. -
Method Summary
Modifier and TypeMethodDescriptionvoidPosts a new event on the event bus for the given type.<T extends IModEvent>
voidsubscribe(@NotNull Class<T> eventType, @NotNull EventBus.EventHandler<T> handler) Subscribe to the given event type, providing a handler function.
-
Method Details
-
subscribe
<T extends IModEvent> void subscribe(@NotNull @NotNull Class<T> eventType, @NotNull @NotNull EventBus.EventHandler<T> handler) Subscribe to the given event type, providing a handler function.- Type Parameters:
T- the generic type of the event class.- Parameters:
eventType- the event class type.handler- the handler function handling the event logic.
-
post
Posts a new event on the event bus for the given type.- Parameters:
event- the event to send.
-