Invalid leaf directive! `since`

Manages the registration and handling of custom handlers for the various events of the game.

You can register event handlers for pretty much everything, but make sure that the class you are referencing is documented as an event, otherwise you're in for a nasty surprise.

Importing the class

Link to importing-the-class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.events.EventManager;

Name: register

Registers a new event listener.

ZenScript
Copy
EventManager.register<T : Object>(consumer as Consumer<T>)
ParameterTypeDescription
Parameter
consumer
Type
Consumer<T>
Description
The event handler.
Parameter
T
Type
Object
Description
The type of the event.

Name: register

Registers a new event listener that can listen to cancelled events.

ZenScript
Copy
EventManager.register<T : Object>(listenToCanceled as boolean, consumer as Consumer<T>)
ParameterTypeDescription
Parameter
listenToCanceled
Type
boolean
Description
Whether cancelled events should also be listened to or not.
Parameter
consumer
Type
Consumer<T>
Description
The event handler.
Parameter
T
Type
Object
Description
The type of the event.

Name: register

Registers a new event listener for the specified EventPhase.

ZenScript
Copy
EventManager.register<T : Object>(phase as EventPhase, consumer as Consumer<T>)
ParameterTypeDescription
Parameter
phase
Type
EventPhase
Description
The phase on which the event should be registered.
Parameter
consumer
Type
Consumer<T>
Description
The event handler.
Parameter
T
Type
Object
Description
The type of the event.

Name: register

Registers a new event listener for the specified EventPhase that can listen to cancelled events.

ZenScript
Copy
EventManager.register<T : Object>(phase as EventPhase, listenToCanceled as boolean, consumer as Consumer<T>)
ParameterTypeDescription
Parameter
phase
Type
EventPhase
Description
The phase on which the event should be registered.
Parameter
listenToCanceled
Type
boolean
Description
Whether cancelled events should also be listened to or not.
Parameter
consumer
Type
Consumer<T>
Description
The event handler.
Parameter
T
Type
Object
Description
The type of the event.