[PR #6179] [MERGED] Selectors find firework rockets #6700

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

📋 Pull Request Information

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

Base: main ← Head: fix/firework-selectors


📝 Commits (5)

  • eb4b64e Selectors find firework rockets
  • c6c3f3f Merge main into fix/firework-selectors
  • 79aa093 Merge main into fix/firework-selectors
  • 026f312 Merge commit '51946c9e45' into s6179
  • 3740468 Merge main into fix/firework-selectors

📊 Changes

7 files changed (+58 additions, -11 deletions)

View changed files

📝 crates/horizon-client/src/game/commands.rs (+20 -0)
📝 crates/horizon-client/src/game/commands/data.rs (+7 -0)
📝 crates/horizon-client/src/game/fireworks.rs (+5 -2)
📝 crates/horizon-client/src/game/native_entities.rs (+1 -0)
📝 crates/horizon-client/src/game/persist.rs (+13 -9)
📝 crates/horizon-client/src/game/scoreboard.rs (+2 -0)
📝 tools/command_exec_corpus.py (+10 -0)

📄 Description

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

A follow-up to #6135 (merged), which this was built on.

What and why

The last kind left from the check in #6135: @e[type=minecraft:firework_rocket] matched no rocket, so /kill, /tp, /tag, /data get entity and execute if entity on one answered "No entity was found" or "Test failed". Rockets live in Game::rockets, which the selectors didn't offer, and Horizon had no writer for a rocket's NBT, so /data get had nothing to read.

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

Change

  • entity_nbt.rs: firework_rocket_to_nbt, the mirror of firework_rocket_from_nbt. Projectile's keys (Owner, LeftOwner, HasBeenShot, as put_projectile writes them), then Life, LifeTime, FireworksItem and ShotAtAngle.
  • fireworks.rs: Rocket::saved_fields gives those values. new_rocket (every launch: by hand, dispenser, crossbow, elytra boost, raid celebration) takes an id from the entity counter at once, as #6096 does for primed TNT.
  • persist.rs: a loaded or summoned rocket takes its id the same way and keeps its compound (Tags and the rest) like primed TNT does.
  • commands.rs, commands/data.rs, scoreboard.rs, native_entities.rs: Target::Rocket(id). Offered by the selector, with its position, type, level lookup, /tp, /kill, /data get, score holder, Tags, and spawn_entity_from_nbt returning it (so execute summon minecraft:firework_rocket has its source).
  • tools/command_exec_corpus.py: the entities group summons a tagged rocket and runs a tag selector, tag … list, data get of LifeTime, FireworksItem.id and ShotAtAngle, tp and kill.

Vanilla reference

  • FireworkRocketEntity.addAdditionalSaveData: super.addAdditionalSaveData (Projectile: Owner, LeftOwner, HasBeenShot), then putInt("Life"), putInt("LifeTime"), store("FireworksItem", ItemStack.CODEC, getItem()), putBoolean("ShotAtAngle"). Checked in the 26.3 bytecode with javap.
  • EntitySelector.findEntities finds a rocket like any entity; Entity.kill discards it without exploding.

Test

tools/test_command_exec_parity.py, which runs each command on vanilla's real implementations and on Horizon:

entities
#6135's branch (0d342f6c7) + the new cases 87/94 match: the 7 rocket cases after the summon fail. Vanilla finds 1 (Firework Rocket has 1 tag(s): r, Killed Firework Rocket, …); Horizon finds none.
this branch 94/94 match

The whole corpus: 1464/1465. The one miss is the experience orb stuck group's settled Pos (z 23.25 vs 23.5). It is flaky: I reran that group twice on each side, and it gave 3/4 once and 4/4 once both with and without this change.

In game (single player, survival, a rocket with flight 1 launched twice by right click on the ground):

  • First launch: it flies with its trail, execute if entity @e[type=minecraft:firework_rocket] passes (Count 1), data get … LifeTime is 27, and 4 s later it has exploded and nothing matches.
  • Second launch: it is found, kill @e[type=minecraft:firework_rocket] answers "Killed Firework Rocket", and nothing matches after.

Self-check

pr_ready (tools/pr_ready.py --quick --base 0d342f6c7 on DESKTOP-S9O4938, 5 min 57 s):

Check Result
Scope ✅ 8 files, +114 −5
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 585 run, FAILED (errors=1, skipped=1)
rustfmt ✅
clippy ✅
tests: horizon-client ❌ 1188 passed, 1 failed
doc tests ✅
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses

Neither failure is in this change:

  • entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation fails the same way on main without it (see #6135).
  • test_port_ledger cannot import tests.test_class_index on this machine, as on main.

🤖 Generated with Claude Code


🔄 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/6179 **Author:** [@k3yh](https://github.com/k3yh) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/firework-selectors` --- ### 📝 Commits (5) - [`eb4b64e`](https://github.com/horizon-rust/horizon/commit/eb4b64e1e46d528a34df60c71b39cea4f46ee9b0) Selectors find firework rockets - [`c6c3f3f`](https://github.com/horizon-rust/horizon/commit/c6c3f3f96d23460f1b1c647ca71c795be461f0f7) Merge main into fix/firework-selectors - [`79aa093`](https://github.com/horizon-rust/horizon/commit/79aa093cc0b9a99c7457f9b320c52e041510e80e) Merge main into fix/firework-selectors - [`026f312`](https://github.com/horizon-rust/horizon/commit/026f3125f4a295e11c39d99a22404d153c24bc23) Merge commit '51946c9e4585a2e7f2e4af01af893fb6c1cfad0e' into s6179 - [`3740468`](https://github.com/horizon-rust/horizon/commit/3740468b53a9bbf307615f0eec6bb86544f8fe8f) Merge main into fix/firework-selectors ### 📊 Changes **7 files changed** (+58 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands.rs` (+20 -0) 📝 `crates/horizon-client/src/game/commands/data.rs` (+7 -0) 📝 `crates/horizon-client/src/game/fireworks.rs` (+5 -2) 📝 `crates/horizon-client/src/game/native_entities.rs` (+1 -0) 📝 `crates/horizon-client/src/game/persist.rs` (+13 -9) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+2 -0) 📝 `tools/command_exec_corpus.py` (+10 -0) </details> ### 📄 Description > 🤖 Opened by k3yh's AI agent (Claude Code, Claude Opus 5.5), not by k3yh personally. A follow-up to #6135 (merged), which this was built on. ## What and why The last kind left from the check in #6135: `@e[type=minecraft:firework_rocket]` matched no rocket, so `/kill`, `/tp`, `/tag`, `/data get entity` and `execute if entity` on one answered "No entity was found" or "Test failed". Rockets live in `Game::rockets`, which the selectors didn't offer, and Horizon had no writer for a rocket's NBT, so `/data get` had nothing to read. ## Kind - [x] 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 ## Change - `entity_nbt.rs`: `firework_rocket_to_nbt`, the mirror of `firework_rocket_from_nbt`. `Projectile`'s keys (`Owner`, `LeftOwner`, `HasBeenShot`, as `put_projectile` writes them), then `Life`, `LifeTime`, `FireworksItem` and `ShotAtAngle`. - `fireworks.rs`: `Rocket::saved_fields` gives those values. `new_rocket` (every launch: by hand, dispenser, crossbow, elytra boost, raid celebration) takes an id from the entity counter at once, as #6096 does for primed TNT. - `persist.rs`: a loaded or summoned rocket takes its id the same way and keeps its compound (`Tags` and the rest) like primed TNT does. - `commands.rs`, `commands/data.rs`, `scoreboard.rs`, `native_entities.rs`: `Target::Rocket(id)`. Offered by the selector, with its position, type, level lookup, `/tp`, `/kill`, `/data get`, score holder, `Tags`, and `spawn_entity_from_nbt` returning it (so `execute summon minecraft:firework_rocket` has its source). - `tools/command_exec_corpus.py`: the `entities` group summons a tagged rocket and runs a tag selector, `tag … list`, `data get` of `LifeTime`, `FireworksItem.id` and `ShotAtAngle`, `tp` and `kill`. ## Vanilla reference - `FireworkRocketEntity.addAdditionalSaveData`: `super.addAdditionalSaveData` (`Projectile`: `Owner`, `LeftOwner`, `HasBeenShot`), then `putInt("Life")`, `putInt("LifeTime")`, `store("FireworksItem", ItemStack.CODEC, getItem())`, `putBoolean("ShotAtAngle")`. Checked in the 26.3 bytecode with `javap`. - `EntitySelector.findEntities` finds a rocket like any entity; `Entity.kill` discards it without exploding. ## Test `tools/test_command_exec_parity.py`, which runs each command on vanilla's real implementations and on Horizon: | | entities | |---|---| | #6135's branch (0d342f6c7) + the new cases | 87/94 match: the 7 rocket cases after the summon fail. Vanilla finds 1 (`Firework Rocket has 1 tag(s): r`, `Killed Firework Rocket`, …); Horizon finds none. | | this branch | 94/94 match | The whole corpus: 1464/1465. The one miss is the `experience orb stuck` group's settled `Pos` (z 23.25 vs 23.5). It is flaky: I reran that group twice on each side, and it gave 3/4 once and 4/4 once both with and without this change. In game (single player, survival, a rocket with flight 1 launched twice by right click on the ground): - First launch: it flies with its trail, `execute if entity @e[type=minecraft:firework_rocket]` passes (Count 1), `data get … LifeTime` is 27, and 4 s later it has exploded and nothing matches. - Second launch: it is found, `kill @e[type=minecraft:firework_rocket]` answers "Killed Firework Rocket", and nothing matches after. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base 0d342f6c7` on DESKTOP-S9O4938, 5 min 57 s): | Check | Result | | --- | --- | | Scope | ✅ 8 files, +114 −5 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 585 run, FAILED (errors=1, skipped=1) | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client | ❌ 1188 passed, 1 failed | | doc tests | ✅ | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | Neither failure is in this change: - `entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation` fails the same way on main without it (see #6135). - `test_port_ledger` cannot import `tests.test_class_index` on this machine, as on main. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:25:05 +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#6700
No description provided.