Skip to main content
The HitBoxListener interface provides a builder-based system for handling events related to hitboxes, including interactions, damage, mounting, and lifecycle events.

Class Information

Package: kr.toxicity.model.api.nms
Type: Interface
Since: 1.15.2

Overview

Hitbox listeners enable custom behavior when players or entities interact with model hitboxes. The builder pattern allows composing multiple event handlers together.

Creating Listeners

Empty Listener

A no-op listener that does nothing. Useful as a default.

Builder Creation

Creates a new builder for constructing listeners. Example:

Event Handlers

Interaction Events

Basic Interaction

Triggered when a player right-clicks the hitbox. Example:

Interact At Position

Triggered when a player right-clicks at a specific position on the hitbox. Example:

Damage Events

Triggered when the hitbox takes damage. Example:

Mount Events

Entity Mounted

Triggered when an entity mounts the hitbox. Example:

Entity Dismounted

Triggered when an entity dismounts from the hitbox. Example:

Lifecycle Events

Creation

Triggered when the hitbox is created. Example:

Removal

Triggered when the hitbox is removed. Example:

Tick Synchronization

Called every tick to synchronize hitbox state. Example:

Generic Event Handling

Register a handler for any hitbox event type. Example:

Builder Methods

All builder methods return the builder for chaining:

Modifying Existing Listeners

Converts a listener back to a builder to add more handlers. Example:

Internal Methods

These methods are called internally by the hitbox implementation and should not be invoked directly.

Complete Examples

Interactive NPC

Combat Target Dummy

Rideable Vehicle

Collectible Item

See Also