Interface EventBus

All Known Implementing Classes:
DefaultEventBus

public interface EventBus
Interface for the mod event bus.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    The event handler lambda definition.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    post(@NotNull IModEvent event)
    Posts a new event on the event bus for the given type.
    <T extends IModEvent>
    void
    subscribe(@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

      void post(@NotNull @NotNull IModEvent event)
      Posts a new event on the event bus for the given type.
      Parameters:
      event - the event to send.