[PR #6575] [MERGED] Six entity kinds get a real id at creation #6957

Closed
opened 2026-11-03 06:30:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6575
Author: @HrafnaValkyrja
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: refactor/stable-entity-ids


📝 Commits (2)

  • c6dcaa6 Take entity ids at creation for bolts, thrown potions, clouds, fireballs, eyes, tridents
  • 968a1b1 Merge remote-tracking branch 'origin/main' into refactor/stable-entity-ids

📊 Changes

6 files changed (+27 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game/dragon.rs (+6 -3)
📝 crates/horizon-client/src/game/end.rs (+3 -1)
📝 crates/horizon-client/src/game/lan_entities.rs (+8 -0)
📝 crates/horizon-client/src/game/lightning.rs (+2 -1)
📝 crates/horizon-client/src/game/potions.rs (+6 -3)
📝 crates/horizon-client/src/game/trident.rs (+2 -1)

📄 Description

🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself.

What and why

Part of #6537. The survey of the 27 entity collections found that most kinds already take an id from next_entity when they are created (mobs, items, orbs, boats, minecarts, paintings, frames, stands, cushions, hooks, fangs, spawners, the dragon and its crystals). Eleven kinds did not: lightning bolts, thrown potions and bottles, breath and lingering clouds, dragon fireballs, eyes of ender and thrown tridents were pushed with id 0 and got an id only when a LAN guest was connected (lan_assign_ids). Alone in single player they kept id 0 for good.

This takes the id at creation for the six kinds with a local creation site (7 sites, one new helper take_entity_id). Nothing else changes. Left for a follow-up because they have many creation and load sites (native mods, NBT, remote): primed TNT, falling blocks, projectiles, firework rockets. EntityMemory.anon is still used by orbs, arrows, falling blocks, rockets, tridents, crystals and the dragon to match saved UUIDs by type and position; its comment is accurate for the kinds that still lack ids, and was not touched.

Changed: game/lightning.rs, game/potions.rs, game/dragon.rs, game/end.rs, game/trident.rs, game/lan_entities.rs.

Part of #6537

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Entity takes id from the single ENTITY_COUNTER in its constructor, so every entity has an id from the moment it exists, whether or not anyone tracks it (the same rule EnderDragon and EndCrystal already follow in game/dragon.rs).

Test

No behaviour change is intended, so there is no new test. Checked against origin/main:

  • Save, quit, reload (cycle.py: 10 summons incl. trident, splash potion, area effect cloud, TNT, rocket, falling block, pearl, snowball; save, reload, 20 ticks, save): the saved entity table is identical before and after the change (positions, fuses, lifetimes; only the random UUIDs differ).
  • Side-by-side selkinds scene (entity selectors, 156 probed values): identical output before and after (126 of 156 match vanilla in both; the 30 existing differences are not from this change).
  • Parity harnesses trident, server_dragon, remote_fireball, dragon_render, cloud_render, entity_particles pass.

What wasn't compared

  • Ids drawn at creation shift the numbering of later entities by the number of these kinds spawned; no id is observable in the compared scenes.
  • The other four id-0 kinds (TNT, falling blocks, projectiles, rockets) are not changed here.

A refactor with no behaviour change; proved by script, no human played this change.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick on Valhalla, against origin/main at 7a319ed7b, 3 min 0 s)

Check Result
Scope ✅ 7 files, +27 −9
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 595 passed (26 s)
rustfmt ✅ (6 s)
Rust ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ✅ (1 min 18 s)
tests: horizon-client ✅ 591 passed (1 min 7 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 324 affected, to run in CI (--quick): armor_stand_frost, arrow, arrow_wind_charge, block_removal, boat_authority, boat_paddle_reset, boat_submerged, bulk_section, bundle_weight, camera, canyon_carver, carving_geometry and 312 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code

https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/6575 **Author:** [@HrafnaValkyrja](https://github.com/HrafnaValkyrja) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `refactor/stable-entity-ids` --- ### 📝 Commits (2) - [`c6dcaa6`](https://github.com/horizon-rust/horizon/commit/c6dcaa6b46d2b432589e266dbb55c71b3bf1ae29) Take entity ids at creation for bolts, thrown potions, clouds, fireballs, eyes, tridents - [`968a1b1`](https://github.com/horizon-rust/horizon/commit/968a1b147564b82ea725747691f986c3c1e107c2) Merge remote-tracking branch 'origin/main' into refactor/stable-entity-ids ### 📊 Changes **6 files changed** (+27 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/dragon.rs` (+6 -3) 📝 `crates/horizon-client/src/game/end.rs` (+3 -1) 📝 `crates/horizon-client/src/game/lan_entities.rs` (+8 -0) 📝 `crates/horizon-client/src/game/lightning.rs` (+2 -1) 📝 `crates/horizon-client/src/game/potions.rs` (+6 -3) 📝 `crates/horizon-client/src/game/trident.rs` (+2 -1) </details> ### 📄 Description > 🤖 Opened by Valkyrie's AI agent (Claude Code, Opus 5.5), not by Valkyrie herself. ## What and why Part of #6537. The survey of the 27 entity collections found that most kinds already take an id from `next_entity` when they are created (mobs, items, orbs, boats, minecarts, paintings, frames, stands, cushions, hooks, fangs, spawners, the dragon and its crystals). Eleven kinds did not: lightning bolts, thrown potions and bottles, breath and lingering clouds, dragon fireballs, eyes of ender and thrown tridents were pushed with id 0 and got an id only when a LAN guest was connected (`lan_assign_ids`). Alone in single player they kept id 0 for good. This takes the id at creation for the six kinds with a local creation site (7 sites, one new helper `take_entity_id`). Nothing else changes. Left for a follow-up because they have many creation and load sites (native mods, NBT, remote): primed TNT, falling blocks, projectiles, firework rockets. `EntityMemory.anon` is still used by orbs, arrows, falling blocks, rockets, tridents, crystals and the dragon to match saved UUIDs by type and position; its comment is accurate for the kinds that still lack ids, and was not touched. Changed: `game/lightning.rs`, `game/potions.rs`, `game/dragon.rs`, `game/end.rs`, `game/trident.rs`, `game/lan_entities.rs`. Part of #6537 ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [x] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `Entity` takes `id` from the single `ENTITY_COUNTER` in its constructor, so every entity has an id from the moment it exists, whether or not anyone tracks it (the same rule `EnderDragon` and `EndCrystal` already follow in `game/dragon.rs`). ## Test No behaviour change is intended, so there is no new test. Checked against origin/main: - Save, quit, reload (`cycle.py`: 10 summons incl. trident, splash potion, area effect cloud, TNT, rocket, falling block, pearl, snowball; save, reload, 20 ticks, save): the saved entity table is identical before and after the change (positions, fuses, lifetimes; only the random UUIDs differ). - Side-by-side `selkinds` scene (entity selectors, 156 probed values): identical output before and after (126 of 156 match vanilla in both; the 30 existing differences are not from this change). - Parity harnesses `trident`, `server_dragon`, `remote_fireball`, `dragon_render`, `cloud_render`, `entity_particles` pass. ## What wasn't compared - Ids drawn at creation shift the numbering of later entities by the number of these kinds spawned; no id is observable in the compared scenes. - The other four id-0 kinds (TNT, falling blocks, projectiles, rockets) are not changed here. A refactor with no behaviour change; proved by script, no human played this change. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Valhalla, against origin/main at 7a319ed7b, 3 min 0 s) | Check | Result | | --- | --- | | Scope | ✅ 7 files, +27 −9 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 595 passed (26 s) | | rustfmt | ✅ (6 s) | | Rust | ⚠️ 1.98.0 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ✅ (1 min 18 s) | | tests: horizon-client | ✅ 591 passed (1 min 7 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 324 affected, to run in CI (--quick): armor_stand_frost, arrow, arrow_wind_charge, block_removal, boat_authority, boat_paddle_reset, boat_submerged, bulk_section, bundle_weight, camera, canyon_carver, carving_geometry and 312 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_018zuDTsnyHkP28bzn3u7S3m --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:30:19 +07:00
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#6957
No description provided.