Skip to main content

Overview

BaseEntity is the primary entity adapter interface in BetterModel. It provides a unified way to access entity properties, manage custom models, and interact with the entity tracking system. This interface acts as a bridge between platform-specific entities and BetterModel’s internal entity management. Package: kr.toxicity.model.api.entity Extends: Identifiable

Factory Method

of()

Creates a BaseEntity adapter from a platform-specific entity. Parameters:
  • entity - Platform entity to adapt
Returns: Base entity adapter Example:

Core Methods

platform()

Gets the underlying platform-specific entity object. Returns: The platform entity Since: 2.0.0

location()

Gets the current location of the entity. Returns: The entity’s location Since: 2.0.0

handle()

Gets the vanilla (NMS) entity handle. Returns: Vanilla entity object

id()

Gets the entity’s network ID. Returns: Entity ID

State Queries

dead()

Checks if the entity is dead. Returns: true if dead

ground()

Checks if the entity is on the ground. Returns: true if on ground

invisible()

Checks if the entity has the invisible effect. Returns: true if invisible

glow()

Checks if the entity has the glowing effect. Returns: true if glowing

onWalk()

Checks if the entity is currently walking. Returns: true if walking

fly()

Checks if the entity is flying. Returns: true if flying

Appearance Properties

customName()

Gets the entity’s custom name component. Returns: Custom name, or null if none

scale()

Gets the entity’s scale multiplier. Returns: Scale value

Rotation Properties

pitch()

Gets the entity’s pitch (x-rotation). Returns: Pitch in degrees

yaw()

Gets the entity’s yaw (y-rotation). Returns: Yaw in degrees

bodyYaw()

Gets the entity’s body yaw (y-rotation). Returns: Body yaw in degrees

headYaw()

Gets the entity’s head yaw (y-rotation). Returns: Head yaw in degrees

Movement Properties

walkSpeed()

Gets the entity’s walk speed. Returns: Walk speed value

damageTick()

Gets the entity’s damage animation tick. Returns: Damage tick value

passengerPosition()

Calculates the passenger attachment point for this entity. Parameters:
  • dest - Destination vector to write result
Returns: The destination vector with passenger position

Equipment

mainHand()

Gets the item in the entity’s main hand. Returns: Main hand item stack

offHand()

Gets the item in the entity’s offhand. Returns: Offhand item stack

Tracking

trackedBy()

Gets the stream of players currently tracking this entity. Returns: Stream of tracking players

registry()

Gets the tracker registry associated with this entity. Returns: Optional containing the registry if it exists

hasControllingPassenger()

Checks if this entity has a controlling passenger. Returns: true if has controlling passenger

Model Data

modelData()

Gets this entity’s current model data key. Returns: Model data key, or null if none

modelData(String)

Sets this entity’s model data key. Parameters:
  • modelData - Model data key to set, or null to clear

hasModelData()

Checks if this entity has model data assigned. Returns: true if model data is present

Usage Example

  • PlatformEntity - Platform abstraction layer
  • PlatformLocation - Location representation
  • EntityTrackerRegistry - Entity tracker management
  • TransformedItemStack - Item stack wrapper