Interface HitBox

All Superinterfaces:
Identifiable

public interface HitBox extends Identifiable
Represents a hitbox for a model part, allowing for interaction and collision detection.

Hitboxes are often implemented using invisible entities (like Slimes or Interaction entities) and are linked to specific bones in the model.

Since:
1.15.2
  • Method Details

    • hide

      @Internal void hide(@NotNull @NotNull PlatformPlayer player)
      Hides this hitbox from a specific player.
      Parameters:
      player - the target player
      Since:
      1.15.2
    • show

      @Internal void show(@NotNull @NotNull PlatformPlayer player)
      Shows this hitbox to a specific player.
      Parameters:
      player - the target player
      Since:
      1.15.2
    • groupName

      @NotNull default @NotNull BoneName groupName()
      Returns the name of the bone group associated with this hitbox.
      Returns:
      the group name
      Since:
      1.15.2
    • mountController

      @NotNull @NotNull MountController mountController()
      Returns the mount controller for this hitbox.
      Returns:
      the mount controller
      Since:
      1.15.2
    • mountController

      void mountController(@NotNull @NotNull MountController controller)
      Sets the mount controller for this hitbox.
      Parameters:
      controller - the new mount controller
      Since:
      1.15.2
    • onWalk

      boolean onWalk()
      Checks if the passenger of this hitbox is walking.
      Returns:
      true if walking, false otherwise
      Since:
      1.15.2
    • source

      @NotNull @NotNull PlatformEntity source()
      Returns the source entity of this hitbox.
      Returns:
      the source entity
      Since:
      1.15.2
    • mount

      void mount(@NotNull @NotNull PlatformEntity entity)
      Mounts an entity onto this hitbox.
      Parameters:
      entity - the entity to mount
      Since:
      1.15.2
    • hasMountDriver

      boolean hasMountDriver()
      Checks if this hitbox has a mount driver.
      Returns:
      true if it has a driver, false otherwise
      Since:
      1.15.2
    • hasBeenControlled

      default boolean hasBeenControlled()
      Checks if this hitbox is being controlled by another entity.
      Returns:
      true if controlled, false otherwise
      Since:
      1.15.2
    • dismount

      void dismount(@NotNull @NotNull PlatformEntity entity)
      Dismounts an entity from this hitbox.
      Parameters:
      entity - the entity to dismount
      Since:
      1.15.2
    • dismountAll

      void dismountAll()
      Dismounts all passengers from this hitbox.
      Since:
      1.15.2
    • forceDismount

      boolean forceDismount()
      Checks if a dismount operation is forced.
      Returns:
      true if forced, false otherwise
      Since:
      1.15.2
    • relativePosition

      @NotNull @NotNull org.joml.Vector3f relativePosition()
      Returns the relative position of this hitbox to its source entity.
      Returns:
      the relative position
      Since:
      1.15.2
    • removeHitBox

      void removeHitBox()
      Removes this hitbox safely.
      Since:
      1.15.2
    • listener

      @NotNull @NotNull HitBoxListener listener()
      Returns the listener associated with this hitbox.
      Returns:
      the listener
      Since:
      1.15.2
    • listener

      @Internal void listener(@NotNull @NotNull HitBoxListener listener)
      Sets the listener for this hitbox.
      Parameters:
      listener - the new listener
      Since:
      3.0.2
    • listener

      default void listener(@NotNull @NotNull Function<HitBoxListener.Builder, HitBoxListener.Builder> function)
      Updates the listener for this hitbox using a builder function.

      This method retrieves the current listener, converts it to a builder, applies the provided function, and sets the resulting listener.

      Parameters:
      function - the function to apply to the builder
      Since:
      3.0.2
    • positionSource

      @NotNull @NotNull RenderedBone positionSource()
      Returns the rendered bone that acts as the position source for this hitbox.
      Returns:
      the position source bone
      Since:
      1.15.2
    • registry

      @NotNull default @NotNull Optional<EntityTrackerRegistry> registry()
      Returns the entity tracker registry for this hitbox's source entity.
      Returns:
      an optional containing the registry, or empty if not found
      Since:
      1.15.2