Skip to content

AEventObject

abstract class AEventObject<T, H : Handler<T>, C : HandlerConstructor<T, H>>(val mod: Mod)

Base class for a mod-scoped Architectury event wrapper (e.g. archie-datagen's GatherDataHandler, archie-gametest's RegisterGameTestHandler).

Subclasses wire together an Architectury event, the handlerConstructor that builds a mod-scoped H from a T callback, and the handler logic itself, then call init once (idempotently, thread-safely) to register with the underlying event.

Parameters

  • T: The event payload/receiver type passed to handler.

  • H: The Handler type produced for mod.

  • C: The HandlerConstructor that builds an H.

  • mod: The Mod this event object is scoped to.

Constructors

AEventObject

constructor(mod: Mod)

Parameters

  • T: The event payload/receiver type passed to handler.

  • H: The Handler type produced for mod.

  • C: The HandlerConstructor that builds an H.

  • mod: The Mod this event object is scoped to.

Properties

event

abstract val event: Event<H>

The underlying Architectury event this wrapper registers a handler with.

handlerConstructor

abstract val handlerConstructor: C

Builds a mod-scoped H from the handler callback.

mod

val mod: Mod

Parameters

  • mod: The Mod this event object is scoped to.

Functions

handler

abstract fun T.handler()

The callback invoked when event fires for mod.

init

fun init()

Registers handler with event via handlerConstructor. Safe to call multiple times; only the first call has any effect.