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
See Also:
  • LivingEntity
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    dismount(@NotNull org.bukkit.entity.Entity entity)
    Dismounts an entity from this hitbox.
    void
    Dismounts all passengers from this hitbox.
    boolean
    Checks if a dismount operation is forced.
    default @NotNull BoneName
    Returns the name of the bone group associated with this hitbox.
    default boolean
    Checks if this hitbox is being controlled by another entity.
    boolean
    Checks if this hitbox has a mount driver.
    void
    hide(@NotNull org.bukkit.entity.Player player)
    Hides this hitbox from a specific player.
    Returns the listener associated with this hitbox.
    void
    mount(@NotNull org.bukkit.entity.Entity entity)
    Mounts an entity onto this hitbox.
    Returns the mount controller for this hitbox.
    void
    mountController(@NotNull MountController controller)
    Sets the mount controller for this hitbox.
    boolean
    Checks if the passenger of this hitbox is walking.
    @NotNull RenderedBone
    Returns the rendered bone that acts as the position source for this hitbox.
    Returns the entity tracker registry for this hitbox's source entity.
    @NotNull org.joml.Vector3f
    Returns the relative position of this hitbox to its source entity.
    void
    Removes this hitbox safely.
    void
    show(@NotNull org.bukkit.entity.Player player)
    Shows this hitbox to a specific player.
    @NotNull org.bukkit.entity.Entity
    Returns the source entity of this hitbox.
    void
    triggerInteract(@NotNull org.bukkit.entity.Player player, @NotNull ModelInteractionHand hand)
    Triggers an interaction with this hitbox.
    void
    triggerInteractAt(@NotNull org.bukkit.entity.Player player, @NotNull ModelInteractionHand hand, @NotNull org.bukkit.util.Vector position)
    Triggers an interaction with this hitbox at a specific position.

    Methods inherited from interface kr.toxicity.model.api.nms.Identifiable

    id, uuid
  • Method Details

    • triggerInteract

      @Internal void triggerInteract(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull ModelInteractionHand hand)
      Triggers an interaction with this hitbox.
      Parameters:
      player - the player interacting
      hand - the hand used
      Since:
      1.15.2
    • triggerInteractAt

      @Internal void triggerInteractAt(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull ModelInteractionHand hand, @NotNull @NotNull org.bukkit.util.Vector position)
      Triggers an interaction with this hitbox at a specific position.
      Parameters:
      player - the player interacting
      hand - the hand used
      position - the interaction position
      Since:
      1.15.2
    • hide

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

      @Internal void show(@NotNull @NotNull org.bukkit.entity.Player 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 org.bukkit.entity.Entity source()
      Returns the source entity of this hitbox.
      Returns:
      the source entity
      Since:
      1.15.2
    • mount

      void mount(@NotNull @NotNull org.bukkit.entity.Entity 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 org.bukkit.entity.Entity 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.

      This method is thread-safe, unlike Entity.remove().

      Since:
      1.15.2
    • listener

      @NotNull @NotNull HitBoxListener listener()
      Returns the listener associated with this hitbox.
      Returns:
      the listener
      Since:
      1.15.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