[PR #6096] [MERGED] Selectors find primed TNT #6651

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

📋 Pull Request Information

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

Base: main ← Head: fix/tnt-selectors


📝 Commits (1)

  • 2b01586 Selectors find primed TNT

📊 Changes

6 files changed (+50 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game/commands.rs (+21 -1)
📝 crates/horizon-client/src/game/commands/data.rs (+12 -0)
📝 crates/horizon-client/src/game/native_entities.rs (+2 -1)
📝 crates/horizon-client/src/game/scoreboard.rs (+2 -0)
📝 crates/horizon-client/src/game/tnt.rs (+3 -1)
📝 tools/command_exec_corpus.py (+10 -0)

📄 Description

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

What and why

No issue: I found this while testing #6008. @e[type=minecraft:tnt] matched no primed TNT, so /kill, /tp, /tag, /data get entity and execute if entity on one answered "No entity was found" or "Test failed". Vanilla's PrimedTnt is an ordinary entity, and every selector finds it. Horizon keeps primed TNT in its own list (Game::tnts), which the selectors didn't offer as candidates. The End crystals and the dragon had the same gap, closed in 8909e0510 (#1531); this does the same for primed TNT.

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

  • commands.rs: Target::Tnt(id). The selector offers each primed TNT; its position, type (minecraft:tnt), level lookup, /tp and /kill read or edit Game::tnts.
  • commands/data.rs: /data get entity writes it with the existing entity_nbt::tnt_to_nbt, with its saved data (Tags and the rest) from persist.raw, as boats and carts do.
  • scoreboard.rs: a primed TNT is a score holder by UUID, and its Tags come from its saved data.
  • native_entities.rs: the id of a Target::Tnt.
  • tnt.rs: add_primed_tnt (lit, dispensed, blown up) takes an id from the entity counter at once, as a loaded or summoned one already does, so a command in the same tick can name it. Until now it got one only when the LAN view next assigned ids.
  • tools/command_exec_corpus.py: the entities group summons a tagged primed TNT and runs execute if entity, tag … list, a tag selector, data get … Tags, tp and kill on it.

Vanilla reference

  • PrimedTnt extends Entity and overrides no part of the selection: EntitySelector.findEntities → ServerLevel.getEntities(EntityTypeTest, …) finds it like any entity, and Entity.kill removes it.

Test

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

entities
main + the new cases 60/66 match. All 6 TNT cases fail: vanilla finds 1 TNT (Killed Primed TNT, Primed TNT has 1 tag(s): t, …), Horizon finds none.
this branch 66/66 match

Self-check

pr_ready (tools/pr_ready.py --quick --base f6512a3f4 on DESKTOP-S9O4938, 6 min 38 s), then rebased onto 1c47bf7fd without conflicts:

Check Result
Scope ✅ 6 files, +50 −3
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 533 run, FAILED (errors=1, skipped=1) (52 s)
rustfmt ✅ (8 s)
clippy ✅ (46 s)
tests: horizon-client ✅ 1761 passed (4 min 48 s)
doc tests ✅ 0 passed (1 s)
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses

The Python failure is not in this change: 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/6096 **Author:** [@k3yh](https://github.com/k3yh) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/tnt-selectors` --- ### 📝 Commits (1) - [`2b01586`](https://github.com/horizon-rust/horizon/commit/2b01586564069ed811fa855c23dfa23616dcba04) Selectors find primed TNT ### 📊 Changes **6 files changed** (+50 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands.rs` (+21 -1) 📝 `crates/horizon-client/src/game/commands/data.rs` (+12 -0) 📝 `crates/horizon-client/src/game/native_entities.rs` (+2 -1) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+2 -0) 📝 `crates/horizon-client/src/game/tnt.rs` (+3 -1) 📝 `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. ## What and why No issue: I found this while testing #6008. `@e[type=minecraft:tnt]` matched no primed TNT, so `/kill`, `/tp`, `/tag`, `/data get entity` and `execute if entity` on one answered "No entity was found" or "Test failed". Vanilla's `PrimedTnt` is an ordinary entity, and every selector finds it. Horizon keeps primed TNT in its own list (`Game::tnts`), which the selectors didn't offer as candidates. The End crystals and the dragon had the same gap, closed in 8909e0510 (#1531); this does the same for primed TNT. ## 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 - `commands.rs`: `Target::Tnt(id)`. The selector offers each primed TNT; its position, type (`minecraft:tnt`), level lookup, `/tp` and `/kill` read or edit `Game::tnts`. - `commands/data.rs`: `/data get entity` writes it with the existing `entity_nbt::tnt_to_nbt`, with its saved data (`Tags` and the rest) from `persist.raw`, as boats and carts do. - `scoreboard.rs`: a primed TNT is a score holder by UUID, and its `Tags` come from its saved data. - `native_entities.rs`: the id of a `Target::Tnt`. - `tnt.rs`: `add_primed_tnt` (lit, dispensed, blown up) takes an id from the entity counter at once, as a loaded or summoned one already does, so a command in the same tick can name it. Until now it got one only when the LAN view next assigned ids. - `tools/command_exec_corpus.py`: the `entities` group summons a tagged primed TNT and runs `execute if entity`, `tag … list`, a tag selector, `data get … Tags`, `tp` and `kill` on it. ## Vanilla reference - `PrimedTnt extends Entity` and overrides no part of the selection: `EntitySelector.findEntities` → `ServerLevel.getEntities(EntityTypeTest, …)` finds it like any entity, and `Entity.kill` removes it. ## Test `tools/test_command_exec_parity.py --only entities`, which runs each command on vanilla's real implementations and on Horizon: | | entities | |---|---| | main + the new cases | 60/66 match. All 6 TNT cases fail: vanilla finds 1 TNT (`Killed Primed TNT`, `Primed TNT has 1 tag(s): t`, …), Horizon finds none. | | this branch | 66/66 match | ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base f6512a3f4` on DESKTOP-S9O4938, 6 min 38 s), then rebased onto 1c47bf7fd without conflicts: | Check | Result | | --- | --- | | Scope | ✅ 6 files, +50 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 533 run, FAILED (errors=1, skipped=1) (52 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (46 s) | | tests: horizon-client | ✅ 1761 passed (4 min 48 s) | | doc tests | ✅ 0 passed (1 s) | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | The Python failure is not in this change: `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:24:21 +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#6651
No description provided.