Avatar Tracker
What Is Avatar Tracker?
Avatar tracker is an entity tracker that store avatar profile data and runtime data. The tracker always have an avatar profile, setting the tracker's avatar profile to null will untrack the entity.
The tracker will untrack itself if either one is true:
- The entity is unloaded for a set period of time (config
unloadedTickCount) - The entity is considered dead or removed when loaded
How To Get Avatar Tracker?
1. Avatar Tracker Manager
AvatarTrackerManager.INSTANCE.get(<entity> or <uuid>) is the common way to get the avatar tracker,
as long as you have the entity or the entity's uuid.
2. Through Avatar Render State
If your code can get AvatarRenderState, use AvatarTrackedEntity.skinmatics$getTracker() to get avatar tracker
import dev.proststuff.skinmatics.avatar.extension.AvatarTrackedEntity;
import dev.proststuff.skinmatics.avatar.AvatarTracker;
import net.minecraft.client.renderer.entity.state.AvatarRenderState;
public class SomeClass {
public void someMethod(AvatarRenderState renderState) {
AvatarTracker tracker = ((AvatarTrackedEntity) renderState).skinmatics$getTracker();
}
}
Note: skinmatics$getTracker() will return null if it's called before AvatarRenderer.extractRenderState()