Class BoneEventDispatcher

java.lang.Object
kr.toxicity.model.api.bone.BoneEventDispatcher

public final class BoneEventDispatcher extends Object
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 Details

    • BoneEventDispatcher

      public BoneEventDispatcher()
  • Method Details

    • extend

      public void extend(@NotNull @NotNull BoneEventDispatcher dispatcher)
      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

      public void handleStateCreate(@NotNull @NotNull BiConsumer<RenderedBone, UUID> function)
      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

      public void handleStateRemove(@NotNull @NotNull BiConsumer<RenderedBone, UUID> function)
      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