NpcHandle from the earlier guides as npc, and the connected player in the same
instance as player.
Change only scale or glow
You do not need a private animation for a simple appearance change:npc.clearViewerState(player) to restore the shared appearance. Both calls return stages;
observe their failures using the error handling from the earlier guides.
Give the player a private animation
First prepare a private copy. Keep its start token so you can cancel it if the player leaves before preparation finishes:ready.thenCompose(handle -> handle.playClip("wave")) starts a wave
only for this player. Observe that returned stage too. Private clips advance through the
library’s own clock; do not attach the shared NpcAnimations helper to them.
Return to shared behavior
Keep the start token until cleanup completes.
personal.cancel() also handles a copy that
has not become ready. Await it during your application’s disconnect/teardown handling.
The runnable example
shows a session owner that handles repeated commands, disconnects and cancellation.
Keep private sounds private
Setsounds(...) on NpcPresentationOptions.builder(player) to send cues only to the supplied
recipient. Use recipient.playSound(...), rather than your shared nearby-player callback.
The default private sound callback is silent. Closing a copy cannot stop audio already sent
to the Minecraft client.
Reconnects and server transfers
A presentation belongs to a concretePlayer connection, not an account UUID. Cancel and
remove the old session on disconnect. A reconnect or backend transfer needs a new local
presentation on the destination server.
In a network with multiple proxies, use your network’s presence/routing data to find the
player’s current backend. The NPC library does not perform that lookup or forward handles
between servers. Another proxy’s player must not be treated as locally connected.