HitBoxListener

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

Types

Link copied to clipboard
open class Builder
Builder for HitBoxListener.
Link copied to clipboard
interface OnDamage
Functional interface for handling damage events.

Properties

Link copied to clipboard
An empty listener that does nothing.

Functions

Link copied to clipboard
@NotNull
open fun builder(): @NotNull HitBoxListener.Builder
Creates a new builder for HitBoxListener.
Link copied to clipboard
abstract fun damage(@NotNull hitBox: @NotNull HitBox, @NotNull source: @NotNull ModelDamageSource, damage: Double): Boolean
Called when the hitbox receives damage.
Link copied to clipboard
abstract fun dismount(@NotNull hitBox: @NotNull HitBox, @NotNull entity: @NotNull Entity)
Called when an entity dismounts the hitbox.
Link copied to clipboard
abstract fun mount(@NotNull hitBox: @NotNull HitBox, @NotNull entity: @NotNull Entity)
Called when an entity mounts the hitbox.
Link copied to clipboard
abstract fun remove(@NotNull hitBox: @NotNull HitBox)
Called when the hitbox is removed.
Link copied to clipboard
abstract fun sync(@NotNull hitBox: @NotNull HitBox)
Called when the hitbox is synchronized (ticked).
Link copied to clipboard
@NotNull
open fun toBuilder(): @NotNull HitBoxListener.Builder
Creates a builder initialized with this listener's current handlers.