Interface HitBoxListener


public interface HitBoxListener
Listens for events related to a HitBox, such as damage, interaction, and mounting.

This interface allows for custom behavior when a hitbox is interacted with.

Since:
1.15.2
  • Field Details

    • EMPTY

      static final HitBoxListener EMPTY
      An empty listener that does nothing.
      Since:
      1.15.2
  • Method Details

    • builder

      @NotNull static @NotNull HitBoxListener.Builder builder()
      Creates a new builder for HitBoxListener.
      Returns:
      a new builder
      Since:
      1.15.2
    • toBuilder

      @NotNull default @NotNull HitBoxListener.Builder toBuilder()
      Creates a builder initialized with this listener's current handlers.
      Returns:
      a new builder
      Since:
      1.15.2
    • sync

      void sync(@NotNull @NotNull HitBox hitBox)
      Called when the hitbox is synchronized (ticked).
      Parameters:
      hitBox - the target hitbox
      Since:
      1.15.2
    • damage

      boolean damage(@NotNull @NotNull HitBox hitBox, @NotNull @NotNull ModelDamageSource source, double damage)
      Called when the hitbox receives damage.
      Parameters:
      hitBox - the target hitbox
      source - the damage source
      damage - the damage amount
      Returns:
      true if the damage was cancelled
      Since:
      1.15.2
    • remove

      void remove(@NotNull @NotNull HitBox hitBox)
      Called when the hitbox is removed.
      Parameters:
      hitBox - the target hitbox
      Since:
      1.15.2
    • mount

      void mount(@NotNull @NotNull HitBox hitBox, @NotNull @NotNull PlatformEntity PlatformEntity)
      Called when an PlatformEntity mounts the hitbox.
      Parameters:
      hitBox - the target hitbox
      PlatformEntity - the mounting PlatformEntity
      Since:
      1.15.2
    • dismount

      void dismount(@NotNull @NotNull HitBox hitBox, @NotNull @NotNull PlatformEntity PlatformEntity)
      Called when an PlatformEntity dismounts the hitbox.
      Parameters:
      hitBox - the target hitbox
      PlatformEntity - the dismounting PlatformEntity
      Since:
      1.15.2