PlayerTracker

A specialized EntityTracker for tracking players.

This tracker automatically configures the body rotator to player mode, ensuring correct head and body rotation synchronization for player entities.

Since

1.15.2

Constructors

Link copied to clipboard
@ApiStatus.Internal
constructor(@NotNull registry: @NotNull EntityTrackerRegistry, @NotNull pipeline: @NotNull RenderPipeline, @NotNull modifier: @NotNull TrackerModifier, @NotNull preUpdateConsumer: @NotNull Consumer<EntityTracker>)
Creates a new player tracker.

Properties

Link copied to clipboard
The multiplier to convert tracker ticks to Minecraft ticks (50ms).
Link copied to clipboard
The interval in milliseconds between tracker ticks.

Functions

Link copied to clipboard
open fun animate(@NotNull animation: @NotNull String): Boolean
Plays an animation by name with default settings.
open fun animate(@NotNull animation: @NotNull TrackerAnimation<out Any>): Boolean
open fun animate(@NotNull animation: @NotNull TrackerAnimation<out Any>, @NotNull removeTask: @NotNull Runnable): Boolean

open fun animate(@NotNull animation: @NotNull String, @NotNull modifier: @NotNull AnimationModifier): Boolean
Plays an animation by name with a modifier.
open fun animate(@NotNull animation: @NotNull BlueprintAnimation, @NotNull modifier: @NotNull AnimationModifier): Boolean
Plays a blueprint animation with a modifier.
open fun animate(@NotNull animation: @NotNull String, @NotNull modifier: @NotNull AnimationModifier, @NotNull removeTask: @NotNull Runnable): Boolean
Plays an animation by name with a modifier and a completion task.
open fun animate(@NotNull animation: @NotNull BlueprintAnimation, @NotNull modifier: @NotNull AnimationModifier, @NotNull removeTask: @NotNull Runnable): Boolean
Plays a blueprint animation on filtered bones.
Link copied to clipboard
@NotNull
open fun asTrackerData(): @NotNull TrackerData
Converts the current tracker state to a TrackerData object.
Link copied to clipboard
@NotNull
open fun bodyRotator(): @NotNull EntityBodyRotator
Returns the entity body rotator.
Link copied to clipboard
@Nullable
open fun bone(@NotNull name: @NotNull String): @Nullable RenderedBone
Retrieves a bone by name string.
@Nullable
open fun bone(@NotNull predicate: @NotNull Predicate<RenderedBone>): @Nullable RenderedBone
Retrieves the first bone matching a predicate.
@Nullable
open fun bone(@NotNull name: @NotNull BoneName): @Nullable RenderedBone
Retrieves a bone by name.
Link copied to clipboard
@NotNull
@Unmodifiable
open fun bones(): @NotNull @Unmodifiable Collection<RenderedBone>
Returns a collection of all bones in the model.
Link copied to clipboard
open fun canBeSaved(): Boolean
Checks if this tracker's data can be saved.
Link copied to clipboard
open fun canBeSpawnedAt(@NotNull player: @NotNull PlatformPlayer): Boolean
Checks if the model can be spawned for a specific player.
Link copied to clipboard
open fun cancelDamageTint()
Cancels the active damage tint effect.
Link copied to clipboard
abstract fun close()
open fun close()
Link copied to clipboard
open fun createHitBox(@Nullable listener: @Nullable HitBoxListener, @NotNull predicate: @NotNull BonePredicate): Boolean
Creates hitboxes for the entity based on a predicate.
open fun createHitBox(@NotNull entity: @NotNull BaseEntity, @Nullable listener: @Nullable HitBoxListener, @NotNull predicate: @NotNull BonePredicate): Boolean
Creates a hitbox for bones matching a predicate.
Link copied to clipboard
open fun createNametag(@NotNull predicate: @NotNull BonePredicate, @NotNull consumer: @NotNull BiConsumer<RenderedBone, ModelNametag>): Boolean
Creates a nametag for bones matching a predicate.
Link copied to clipboard
open fun damageTint()
Triggers the damage tint effect if enabled.
Link copied to clipboard
open fun damageTintValue(): Int
Returns the current damage tint color value.
open fun damageTintValue(tint: Int)
Sets the damage tint color value.
Link copied to clipboard
open fun despawn()
Despawns the model for all players without closing the tracker completely.
Link copied to clipboard
@NotNull
open fun displays(): @NotNull Stream<ModelDisplay>
Returns a stream of all model displays.
Link copied to clipboard
open fun equals(o: Any): Boolean
Link copied to clipboard
open fun forceUpdate(force: Boolean): Boolean
Flags the tracker for a forced update on the next tick.
Link copied to clipboard
@ApiStatus.Internal
open fun forRemoval(): Boolean
Checks if the tracker is marked for removal.
@ApiStatus.Internal
open fun forRemoval(removal: Boolean)
Marks the tracker for removal.
Link copied to clipboard
open fun frame(@NotNull handler: @NotNull Tracker.ScheduledPacketHandler)
Registers a handler to run every frame (tracker tick).
Link copied to clipboard
open fun handleCloseEvent(@NotNull consumer: @NotNull BiConsumer<Tracker, Tracker.CloseReason>)
Registers a handler for the tracker close event.
Link copied to clipboard
open fun hashCode(): Int
Link copied to clipboard
open fun height(): Double
Calculates the height of the model based on its head bone position.
Link copied to clipboard
open fun hide(@NotNull player: @NotNull PlatformPlayer): Boolean
Hides the tracker from a specific player.
Link copied to clipboard
@NotNull
open fun hideOption(): @NotNull EntityHideOption
Returns the hide option for this tracker.
open fun hideOption(@NotNull hideOption: @NotNull EntityHideOption)
Sets the hide option for this tracker.
Link copied to clipboard
@Nullable
open fun hitbox(@Nullable listener: @Nullable HitBoxListener, @NotNull predicate: @NotNull Predicate<RenderedBone>): @Nullable HitBox
Retrieves or creates a hitbox for the entity.
@Nullable
open fun hitbox(@NotNull entity: @NotNull BaseEntity, @Nullable listener: @Nullable HitBoxListener, @NotNull predicate: @NotNull Predicate<RenderedBone>): @Nullable HitBox
Retrieves or creates a hitbox for a specific bone.
Link copied to clipboard
open fun isClosed(): Boolean
Checks if the tracker has been closed.
Link copied to clipboard
open fun isHide(@NotNull player: @NotNull PlatformPlayer): Boolean
Checks if the tracker is hidden from a specific player.
Link copied to clipboard
open fun isScheduled(): Boolean
Checks if the tracker's update task is currently scheduled.
Link copied to clipboard
open fun isSpawned(@NotNull uuid: @NotNull UUID): Boolean
Checks if the model is spawned for a player (by UUID).
open fun isSpawned(@NotNull player: @NotNull PlatformPlayer): Boolean
Checks if the model is spawned for a player.
Link copied to clipboard
Registers a hitbox-listener builder hook that is applied when hitboxes are created.
open fun <T : HitBoxEvent?> listenHitBox(@NotNull eventClass: @NotNull Class<T>, @NotNull consumer: @NotNull Consumer<T>)
Registers a hitbox event listener for newly created hitboxes.
Link copied to clipboard
@NotNull
open fun location(): @NotNull PlatformLocation
Returns the current location of the model.
Link copied to clipboard
open fun markPlayerForSpawn(@NotNull uuids: @NotNull Set<UUID>): Boolean
Marks a set of players for spawning the model.
open fun markPlayerForSpawn(@NotNull player: @NotNull PlatformPlayer): Boolean
Marks a player for spawning the model.
Link copied to clipboard
@NotNull
open fun modifier(): @NotNull TrackerModifier
Returns the tracker modifier.
Link copied to clipboard
@NotNull
open fun name(): @NotNull String
Returns the name of the model being tracked.
Link copied to clipboard
open fun pause(pause: Boolean): Boolean
Pauses or resumes the tracker's ticking.
Link copied to clipboard
open fun perPlayerTick(@NotNull perPlayerHandler: @NotNull BiConsumer<Tracker, PlatformPlayer>)
Registers a handler to run every tick for each visible player.
Link copied to clipboard
open fun playerCount(): Int
Returns the number of players currently viewing the model.
Link copied to clipboard
@ApiStatus.Internal
open fun refresh()
Refreshes the tracker, updating entity data and hitboxes.
Link copied to clipboard
@NotNull
open fun registry(): @NotNull EntityTrackerRegistry
Returns the entity tracker registry associated with this tracker.
Link copied to clipboard
open fun remove(@NotNull player: @NotNull PlatformPlayer): Boolean
Removes the model for a specific player.
Link copied to clipboard
@NotNull
open fun renderer(): @NotNull ModelRenderer
Returns the renderer associated with this tracker.
Link copied to clipboard
open fun replace(@NotNull target: @NotNull String, @NotNull animation: @NotNull String, @NotNull modifier: @NotNull AnimationModifier): Boolean
Replaces a running animation on filtered bones.
open fun replace(@NotNull target: @NotNull String, @NotNull animation: @NotNull BlueprintAnimation, @NotNull modifier: @NotNull AnimationModifier): Boolean
Replaces a running animation on filtered bones with a blueprint animation.
Link copied to clipboard
@NotNull
open fun rotation(): @NotNull ModelRotation
Returns the current rotation of the model.
fun rotation(@NotNull supplier: @NotNull Supplier<ModelRotation>)
Sets the supplier for the base model rotation.
Link copied to clipboard
fun rotator(@NotNull rotator: @NotNull ModelRotator)
Sets the model rotator strategy.
Link copied to clipboard
@NotNull
open fun scaler(): @NotNull ModelScaler
Returns the model scaler.
open fun scaler(@NotNull scaler: @NotNull ModelScaler)
Sets the model scaler.
Link copied to clipboard
open fun schedule(period: Long, @NotNull handler: @NotNull Tracker.ScheduledPacketHandler)
Schedules a handler to run periodically.
Link copied to clipboard
open fun show(@NotNull player: @NotNull PlatformPlayer): Boolean
Shows the tracker to a specific player.
Link copied to clipboard
@NotNull
open fun sourceEntity(): @NotNull BaseEntity
Returns the source entity being tracked.
Link copied to clipboard
open fun stopAnimation(@NotNull animation: @NotNull String): Boolean
Stops an animation by name.
open fun stopAnimation(@NotNull filter: @NotNull Predicate<RenderedBone>, @NotNull animation: @NotNull String): Boolean
Stops an animation on filtered bones.
open fun stopAnimation(@NotNull filter: @NotNull Predicate<RenderedBone>, @NotNull animation: @NotNull String, @Nullable player: @Nullable PlatformPlayer): Boolean
Stops an animation on filtered bones for a specific player (optional).
Link copied to clipboard
open fun task(@NotNull runnable: @NotNull Runnable)
Schedules a task to run on the next tracker tick.
Link copied to clipboard
open fun tick(@NotNull handler: @NotNull Tracker.ScheduledPacketHandler)
Registers a handler to run every Minecraft tick (50ms).
open fun tick(tick: Long, @NotNull handler: @NotNull Tracker.ScheduledPacketHandler)
Registers a handler to run every N Minecraft ticks.
Link copied to clipboard
open fun toString(): String
Link copied to clipboard
open fun tryUpdate(@NotNull action: @NotNull BiPredicate<RenderedBone, BonePredicate>, @NotNull predicate: @NotNull BonePredicate): Boolean
Tries to apply an update action to bones matching a predicate.
Link copied to clipboard
open fun unmarkPlayerForSpawn(@NotNull player: @NotNull PlatformPlayer): Boolean
Unmarks a player for spawning the model.
Link copied to clipboard
open fun <T : TrackerUpdateAction?> update(@NotNull action: @NotNull T)
Forces an update action on all bones.
open fun <T : TrackerUpdateAction?> update(@NotNull action: @NotNull T, @NotNull predicate: @NotNull Predicate<RenderedBone>)
open fun <T : TrackerUpdateAction?> update(@NotNull action: @NotNull T, @NotNull predicate: @NotNull BonePredicate)
Forces an update action on filtered bones.
Link copied to clipboard
open fun updateBaseEntity()
Synchronizes the tracker with the base entity's data asynchronously.