Skip to main content

Overview

PlatformEntity represents an entity in the underlying platform (Bukkit, Folia, etc.). It provides a platform-agnostic interface for accessing basic entity properties like UUID and location, as well as integration with BetterModel’s entity tracking system. Package: kr.toxicity.model.api.platform Extends: PlatformRegionHolder Since: 2.0.0

Core Methods

uuid()

Returns the unique identifier of the entity. Returns: The entity’s UUID Since: 2.0.0

location()

Returns the current location of the entity. Returns: The location Since: 2.0.0

Tracking Integration

registry()

Retrieves the tracker registry associated with this entity. Returns: An optional containing the registry if it exists Since: 2.0.0 Example:

tracker()

Retrieves a specific tracker by name from this entity’s registry. Parameters:
  • name - The name of the tracker
Returns: An optional containing the tracker if found Since: 2.0.0 Example:

Task Scheduling

Inherited from PlatformRegionHolder:

task()

Schedules a task to run on the next tick, synchronized with this entity’s region. Parameters:
  • runnable - The task to run
Returns: The scheduled task, or null if scheduling failed Since: 2.0.0
On Folia servers, tasks are automatically scheduled on the entity’s region thread.

taskLater()

Schedules a task to run after a delay, synchronized with this entity’s region. Parameters:
  • delay - The delay in ticks
  • runnable - The task to run
Returns: The scheduled task, or null if scheduling failed Since: 2.0.0

Platform Adapter Usage

Use BukkitAdapter to convert Bukkit entities to PlatformEntity:

Hierarchy

PlatformEntity is extended by:
  • PlatformLivingEntity - Adds living entity properties (eye location)
  • PlatformPlayer - Adds player-specific properties (name, online status)

Usage Example

  • BaseEntity - Enhanced entity adapter with model data
  • PlatformLocation - Location representation
  • PlatformPlayer - Player-specific interface
  • EntityTrackerRegistry - Entity tracker management
  • PlatformRegionHolder - Region-aware task scheduling