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 Details

    • onMain

      <E extends Event> Subscription onMain(Class<E> type, Consumer<? super E> listener)
      listener runs on the main thread while the event is posted. It may touch game objects and must return quickly: it runs inside the tick.
    • onModThread

      <E extends Event> Subscription onModThread(Class<E> type, Consumer<? super E> listener)
      listener runs later on the mod's own thread. It must not touch game objects; main-thread work goes through main().
      Throws:
      IllegalArgumentException - when type is a MainThreadEvent