Package kr.toxicity.model.api.bone
Class BoneEventDispatcher
java.lang.Object
kr.toxicity.model.api.bone.BoneEventDispatcher
Dispatches events related to bone lifecycle and interaction.
This class manages handlers for hitbox creation, state creation, and state removal. It allows for extending behavior by chaining dispatchers.
- Since:
- 1.15.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidextend(@NotNull BoneEventDispatcher dispatcher) Extends this dispatcher with another dispatcher's handlers.voidhandleCreateHitBox(@NotNull BiFunction<RenderedBone, HitBoxListener.Builder, HitBoxListener.Builder> function) Registers a handler for hitbox creation.voidhandleStateCreate(@NotNull BiConsumer<RenderedBone, UUID> function) Registers a handler for state creation (e.g., when a bone is initialized for a player).voidhandleStateRemove(@NotNull BiConsumer<RenderedBone, UUID> function) Registers a handler for state removal (e.g., when a bone is removed for a player).
-
Constructor Details
-
BoneEventDispatcher
public BoneEventDispatcher()
-
-
Method Details
-
extend
Extends this dispatcher with another dispatcher's handlers.The handlers from the provided dispatcher will be executed before the handlers in this dispatcher.
- Parameters:
dispatcher- the dispatcher to extend- Throws:
UnsupportedOperationException- if attempting to extend self- Since:
- 1.15.2
-
handleCreateHitBox
public void handleCreateHitBox(@NotNull @NotNull BiFunction<RenderedBone, HitBoxListener.Builder, HitBoxListener.Builder> function) Registers a handler for hitbox creation.- Parameters:
function- the function to modify the hitbox listener builder- Since:
- 1.15.2
-
handleStateCreate
Registers a handler for state creation (e.g., when a bone is initialized for a player).- Parameters:
function- the consumer to handle state creation- Since:
- 1.15.2
-
handleStateRemove
Registers a handler for state removal (e.g., when a bone is removed for a player).- Parameters:
function- the consumer to handle state removal- Since:
- 1.15.2
-