Package kr.toxicity.model.api.tracker
Class EntityTracker
java.lang.Object
kr.toxicity.model.api.tracker.Tracker
kr.toxicity.model.api.tracker.EntityTracker
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
PlayerTracker
A tracker implementation that is attached to a living entity.
This tracker synchronizes the model's position, rotation, and animations with the target entity. It handles hitboxes, nametags, damage tinting, and mounting mechanics.
- Since:
- 1.15.2
-
Nested Class Summary
Nested classes/interfaces inherited from class kr.toxicity.model.api.tracker.Tracker
Tracker.BundlerSet, Tracker.CloseReason, Tracker.ScheduledPacketHandler -
Field Summary
Fields inherited from class kr.toxicity.model.api.tracker.Tracker
MINECRAFT_TICK_MULTIPLIER, modifier, pipeline, rotator, scaler, TRACKER_TICK_INTERVAL -
Constructor Summary
ConstructorsConstructorDescriptionEntityTracker(@NotNull EntityTrackerRegistry registry, @NotNull RenderPipeline pipeline, @NotNull TrackerModifier modifier, @NotNull Consumer<EntityTracker> preUpdateConsumer) Creates a new entity tracker. -
Method Summary
Modifier and TypeMethodDescription@NotNull TrackerDataConverts the current tracker state to aTrackerDataobject.@NotNull EntityBodyRotatorReturns the entity body rotator.booleanChecks if this tracker's data can be saved.booleancanBeSpawnedAt(@NotNull PlatformPlayer player) Checks if the model can be spawned for a specific player.voidCancels the active damage tint effect.booleancreateHitBox(@Nullable HitBoxListener listener, @NotNull BonePredicate predicate) Creates hitboxes for the entity based on a predicate.voidTriggers the damage tint effect if enabled.intReturns the current damage tint color value.voiddamageTintValue(int tint) Sets the damage tint color value.voiddespawn()Despawns the model for all players without closing the tracker completely.@NotNull EntityHideOptionReturns the hide option for this tracker.voidhideOption(@NotNull EntityHideOption hideOption) Sets the hide option for this tracker.@Nullable HitBoxhitbox(@Nullable HitBoxListener listener, @NotNull Predicate<RenderedBone> predicate) Retrieves or creates a hitbox for the entity.@NotNull PlatformLocationlocation()Returns the current location of the model.booleanmarkPlayerForSpawn(@NotNull Set<UUID> uuids) Marks a set of players for spawning the model.booleanmarkPlayerForSpawn(@NotNull PlatformPlayer player) Marks a player for spawning the model.voidrefresh()Refreshes the tracker, updating entity data and hitboxes.@NotNull EntityTrackerRegistryregistry()Returns the entity tracker registry associated with this tracker.@NotNull ModelRotationrotation()Returns the current rotation of the model.@NotNull BaseEntityReturns the source entity being tracked.booleanunmarkPlayerForSpawn(@NotNull PlatformPlayer player) Unmarks a player for spawning the model.voidSynchronizes the tracker with the base entity's data asynchronously.Methods inherited from class kr.toxicity.model.api.tracker.Tracker
animate, animate, animate, animate, animate, animate, animate, bone, bone, bone, bones, close, close, createHitBox, createNametag, displays, equals, forceUpdate, forRemoval, forRemoval, frame, handleCloseEvent, hashCode, height, hide, hitbox, isClosed, isHide, isScheduled, isSpawned, isSpawned, listenHitBox, listenHitBox, modifier, name, pause, perPlayerTick, playerCount, remove, renderer, replace, replace, rotation, rotator, scaler, scaler, schedule, show, spawn, stopAnimation, stopAnimation, stopAnimation, task, tick, tick, toString, tryUpdate, update, update, update
-
Constructor Details
-
EntityTracker
@Internal public EntityTracker(@NotNull @NotNull EntityTrackerRegistry registry, @NotNull @NotNull RenderPipeline pipeline, @NotNull @NotNull TrackerModifier modifier, @NotNull @NotNull Consumer<EntityTracker> preUpdateConsumer) Creates a new entity tracker.- Parameters:
registry- the entity tracker registrypipeline- the render pipelinemodifier- the tracker modifierpreUpdateConsumer- a consumer to run before the first update- Since:
- 1.15.2
-
-
Method Details
-
rotation
Description copied from class:TrackerReturns the current rotation of the model. -
updateBaseEntity
public void updateBaseEntity()Synchronizes the tracker with the base entity's data asynchronously.- Since:
- 1.15.2
-
registry
Returns the entity tracker registry associated with this tracker.- Returns:
- the registry
- Since:
- 1.15.2
-
createHitBox
public boolean createHitBox(@Nullable @Nullable HitBoxListener listener, @NotNull @NotNull BonePredicate predicate) Creates hitboxes for the entity based on a predicate.- Parameters:
listener- the hitbox listenerpredicate- the bone predicate- Returns:
- true if any hitboxes were created
- Since:
- 1.15.2
-
hitbox
@Nullable public @Nullable HitBox hitbox(@Nullable @Nullable HitBoxListener listener, @NotNull @NotNull Predicate<RenderedBone> predicate) Retrieves or creates a hitbox for the entity.- Parameters:
listener- the hitbox listenerpredicate- the bone predicate- Returns:
- the hitbox, or null if not found/created
- Since:
- 1.15.2
-
damageTintValue
public int damageTintValue()Returns the current damage tint color value.- Returns:
- the hex color value
- Since:
- 1.15.2
-
damageTintValue
public void damageTintValue(int tint) Sets the damage tint color value.- Parameters:
tint- the hex color value- Since:
- 1.15.2
-
damageTint
public void damageTint()Triggers the damage tint effect if enabled.- Since:
- 1.15.2
-
despawn
public void despawn()Description copied from class:TrackerDespawns the model for all players without closing the tracker completely. -
location
Description copied from class:TrackerReturns the current location of the model. -
sourceEntity
Returns the source entity being tracked.- Returns:
- the source entity
- Since:
- 1.15.2
-
cancelDamageTint
public void cancelDamageTint()Cancels the active damage tint effect.- Since:
- 1.15.2
-
refresh
@Internal public void refresh()Refreshes the tracker, updating entity data and hitboxes.- Since:
- 1.15.2
-
markPlayerForSpawn
Marks a player for spawning the model.- Parameters:
player- the player- Returns:
- true if the player was added
- Since:
- 1.15.2
-
markPlayerForSpawn
Marks a set of players for spawning the model.- Parameters:
uuids- the set of player UUIDs- Returns:
- true if any players were added
- Since:
- 1.15.2
-
unmarkPlayerForSpawn
Unmarks a player for spawning the model.- Parameters:
player- the player- Returns:
- true if the player was removed
- Since:
- 1.15.2
-
asTrackerData
Converts the current tracker state to aTrackerDataobject.- Returns:
- the tracker data
- Since:
- 1.15.2
-
bodyRotator
Returns the entity body rotator.- Returns:
- the body rotator
- Since:
- 1.15.2
-
canBeSpawnedAt
Checks if the model can be spawned for a specific player.- Parameters:
player- the player- Returns:
- true if allowed
- Since:
- 1.15.2
-
hideOption
Returns the hide option for this tracker.- Returns:
- the hide option
- Since:
- 1.15.2
-
hideOption
Sets the hide option for this tracker.- Parameters:
hideOption- the new hide option- Since:
- 1.15.2
-
canBeSaved
public boolean canBeSaved()Checks if this tracker's data can be saved.- Returns:
- true if saveable
- Since:
- 1.15.2
-