[GH-ISSUE #6231] Native mods: a player starting and stopping tracking an entity, PlayerEvent.StartTracking #2025

Closed
opened 2026-11-02 15:51:26 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @levzzz5154 on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6231

Originally assigned to: @levzzz5154 on GitHub.

🤖 Filed by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally.

Part of #4953 ("Player: start tracking (#5816)"). Also a line of #5816's list of hook points a survival server needs.

Problem

A mod that adds data to an entity (a mod mob's state, a name tag, an owner) must send it to each player that gets the entity, and drop its per-player bookkeeping when they lose it. Horizon has the pairing (lan/entity.rs, Entities::tick) but tells the mods nothing.

Vanilla and NeoForge

  • Vanilla: ChunkMap.TrackedEntity.updatePlayer decides, per player, whether an entity is in range, and calls ServerEntity.addPairing(player) (sends the add packets, then startSeenByPlayer) or removePairing(player) (stopSeenByPlayer, ClientboundRemoveEntitiesPacket). Leaving the game, changing level, respawning and an entity being removed all end in removePairing.
  • NeoForge: PlayerEvent.StartTracking(player, target) at the end of addPairing, PlayerEvent.StopTracking(player, target) at the end of removePairing. Neither can be cancelled.

Proposal

Two server hook points, API from a fragment (tools/native-hook-fragments/player_tracking.json):

  • native_player_start_tracking(player, name, entity, uuid, kind)
  • native_player_stop_tracking(player, name, entity, uuid, kind)

The hub's per-client Tracker already is the set of entities a client has been paired with. It keeps a list of starts and stops with the entity's ID, UUID and type, from every place that changes the set (the tick's range checks, a respawned player forgotten, a level change, a player leaving). The game takes them each tick and tells the mods, in order, with no player's state swapped in (so a mod sends what the player needs with native_net_send_to_player; a leaving player has no body to swap in anyway). Each start has one stop.

Not in this step: the dimension and position of the target (the ID and UUID find it), and the chunk watch events (ChunkWatchEvent).

Originally created by @levzzz5154 on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6231 Originally assigned to: @levzzz5154 on GitHub. > 🤖 Filed by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #4953 ("Player: start tracking (#5816)"). Also a line of #5816's list of hook points a survival server needs. ## Problem A mod that adds data to an entity (a mod mob's state, a name tag, an owner) must send it to each player that gets the entity, and drop its per-player bookkeeping when they lose it. Horizon has the pairing (`lan/entity.rs`, `Entities::tick`) but tells the mods nothing. ## Vanilla and NeoForge - Vanilla: `ChunkMap.TrackedEntity.updatePlayer` decides, per player, whether an entity is in range, and calls `ServerEntity.addPairing(player)` (sends the add packets, then `startSeenByPlayer`) or `removePairing(player)` (`stopSeenByPlayer`, `ClientboundRemoveEntitiesPacket`). Leaving the game, changing level, respawning and an entity being removed all end in `removePairing`. - NeoForge: `PlayerEvent.StartTracking(player, target)` at the end of `addPairing`, `PlayerEvent.StopTracking(player, target)` at the end of `removePairing`. Neither can be cancelled. ## Proposal Two server hook points, API from a fragment (`tools/native-hook-fragments/player_tracking.json`): - `native_player_start_tracking(player, name, entity, uuid, kind)` - `native_player_stop_tracking(player, name, entity, uuid, kind)` The hub's per-client `Tracker` already is the set of entities a client has been paired with. It keeps a list of starts and stops with the entity's ID, UUID and type, from every place that changes the set (the tick's range checks, a respawned player forgotten, a level change, a player leaving). The game takes them each tick and tells the mods, in order, with no player's state swapped in (so a mod sends what the player needs with `native_net_send_to_player`; a leaving player has no body to swap in anyway). Each start has one stop. Not in this step: the dimension and position of the target (the ID and UUID find it), and the chunk watch events (`ChunkWatchEvent`).
Author
Owner

@levzzz5154 commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6561942236 --> @levzzz5154 commented on GitHub (Nov 1, 2026): /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2025
No description provided.