Class ZenEventManager
java.lang.Object
com.blamejared.crafttweaker.impl.event.ZenEventManager
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.
- Since:
- 11.0.0
- DocParam:
- this events
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ZenEventManagerRepresents the global entry point for all event handling. -
Method Summary
Modifier and TypeMethodDescription<T> voidRegisters a new event listener that can listen to cancelled events.<T> voidregister(Class<T> typeOfT, ZenEventPhase phase, boolean listenToCanceled, Consumer<T> consumer) Registers a new event listener for the specifiedZenEventPhasethat can listen to cancelled events.<T> voidregister(Class<T> typeOfT, ZenEventPhase phase, Consumer<T> consumer) Registers a new event listener for the specifiedZenEventPhase.<T> voidRegisters a new event listener.
-
Field Details
-
EVENTS
Represents the global entry point for all event handling.- Since:
- 11.0.0
-
-
Method Details
-
register
Registers a new event listener.- Type Parameters:
T- The type of the event.- Parameters:
typeOfT- The reified type of the event.consumer- The event handler.- Since:
- 11.0.0
-
register
Registers a new event listener for the specifiedZenEventPhase.- Type Parameters:
T- The type of the event.- Parameters:
typeOfT- The reified type of the event.phase- The phase on which the event should be registered.consumer- The event handler.- Since:
- 11.0.0
-
register
Registers a new event listener that can listen to cancelled events.- Type Parameters:
T- The type of the event.- Parameters:
typeOfT- The reified type of the event.listenToCanceled- Whether cancelled events should also be listened to or not.consumer- The event handler.- Since:
- 11.0.0
-
register
public <T> void register(Class<T> typeOfT, ZenEventPhase phase, boolean listenToCanceled, Consumer<T> consumer) Registers a new event listener for the specifiedZenEventPhasethat can listen to cancelled events.- Type Parameters:
T- The type of the event.- Parameters:
typeOfT- The reified type of the event.phase- The phase on which the event should be registered.listenToCanceled- Whether cancelled events should also be listened to or not.consumer- The event handler.- Since:
- 11.0.0
-