Package kr.toxicity.model.api.nms
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
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classBuilder forHitBoxListener.static interfaceFunctional interface for handling damage events. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HitBoxListenerAn empty listener that does nothing. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull HitBoxListener.Builderbuilder()Creates a new builder forHitBoxListener.booleandamage(@NotNull HitBox hitBox, @NotNull ModelDamageSource source, double damage) Called when the hitbox receives damage.voiddismount(@NotNull HitBox hitBox, @NotNull PlatformEntity PlatformEntity) Called when an PlatformEntity dismounts the hitbox.voidmount(@NotNull HitBox hitBox, @NotNull PlatformEntity PlatformEntity) Called when an PlatformEntity mounts the hitbox.voidCalled when the hitbox is removed.voidCalled when the hitbox is synchronized (ticked).default @NotNull HitBoxListener.BuilderCreates a builder initialized with this listener's current handlers.
-
Field Details
-
EMPTY
An empty listener that does nothing.- Since:
- 1.15.2
-
-
Method Details
-
builder
Creates a new builder forHitBoxListener.- Returns:
- a new builder
- Since:
- 1.15.2
-
toBuilder
Creates a builder initialized with this listener's current handlers.- Returns:
- a new builder
- Since:
- 1.15.2
-
sync
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 hitboxsource- the damage sourcedamage- the damage amount- Returns:
- true if the damage was cancelled
- Since:
- 1.15.2
-
remove
Called when the hitbox is removed.- Parameters:
hitBox- the target hitbox- Since:
- 1.15.2
-
mount
Called when an PlatformEntity mounts the hitbox.- Parameters:
hitBox- the target hitboxPlatformEntity- the mounting PlatformEntity- Since:
- 1.15.2
-
dismount
Called when an PlatformEntity dismounts the hitbox.- Parameters:
hitBox- the target hitboxPlatformEntity- the dismounting PlatformEntity- Since:
- 1.15.2
-