Contents
Class EventHandler
java.lang.Object
com.hypixel.hytale.builtin.worldgen.modifier.EventHandler
- All Implemented Interfaces:
AutoCloseable
Coordinates world-generation modifier handling for a specific world-gen content root.
This class gathers applicable WorldGenModifiers, orders them by pack priority and modifier
order, groups them by event type, and applies their operations when matching modification events
are dispatched. It also manages a thread-local scoped handler so modifier processing can be opened
for a loading context and automatically cleared when that scope is closed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final record -
Method Summary
Modifier and TypeMethodDescriptionstatic EventHandlerCreates a new EventHandler for the given world-gen content root.voidclose()Releases the EventHandler and clears all internal state.get(Content.Type type) Retrieves the modifiers for the given event type.static <T> voidhandle(ModifyEvent<T> event) Generic event handler for instances ofModifyEvent.
-
Method Details
-
get
Retrieves the modifiers for the given event type.- Parameters:
type- The event type to retrieve modifiers for.- Returns:
- The modifiers for the given event type or an empty array if none are found.
-
close
public void close()Releases the EventHandler and clears all internal state.- Specified by:
closein interfaceAutoCloseable
-
handle
Generic event handler for instances ofModifyEvent.- Type Parameters:
T- The type of content to be modified.- Parameters:
event- The event to handle.
-
acquire
Creates a new EventHandler for the given world-gen content root. The returned value should be held within a try-with-resources block to ensure proper resource cleanup.- Parameters:
root- The root path of the content to be modified.- Returns:
- The newly opened modifier handler.
-