[PR #6135] [MERGED] Selectors find falling blocks and thrown items #6672

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

📋 Pull Request Information

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

Base: main ← Head: fix/more-selectors


📝 Commits (2)

  • 0d342f6 Selectors find falling blocks and thrown items
  • e61a51d Merge main into #6135 (the mod block entity test fix, #6143)

📊 Changes

8 files changed (+92 additions, -8 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -2)
📝 crates/horizon-client/src/game/commands.rs (+34 -1)
📝 crates/horizon-client/src/game/commands/data.rs (+24 -1)
📝 crates/horizon-client/src/game/native_entities.rs (+2 -1)
📝 crates/horizon-client/src/game/native_falling.rs (+2 -1)
📝 crates/horizon-client/src/game/persist.rs (+5 -2)
📝 crates/horizon-client/src/game/scoreboard.rs (+6 -0)
📝 tools/command_exec_corpus.py (+15 -0)

📄 Description

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

What and why

A follow-up to #6096 (selectors find primed TNT). I summoned every entity type Horizon keeps outside the usual lists, ran execute if entity @e[type=…] and kill on each, and compared with vanilla. These still matched nothing:

  • Falling blocks. They live in Game::falling, which the selectors didn't offer. /summon also named one "Falling Block"; vanilla says "Falling Sand" (FallingBlockEntity.getTypeName, entity.minecraft.falling_block_type with the block's name).
  • Snowballs, eggs and ender pearls. They are in the projectile list, but the selector kept only the kinds /data could write (arrows, fireballs, wind charges). entity_nbt::throwable_to_nbt writes the thrown items already.

Firework rockets don't match either, but Horizon has no writer for their NBT yet, so I left them for another PR. /summon minecraft:ominous_item_spawner fails outright, which is a different problem.

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::Falling(id), offered by the selector, with its position, type, level lookup, /tp, /kill and its name ("Falling "). The projectile filter also lets through what entity_nbt::saved_with_chunk saves, which adds the thrown items.
  • commands/data.rs: /data get entity writes a falling block with falling_block_to_nbt and its kept compound (as the chunk save does), and a thrown item with throwable_to_nbt. spawn_entity_from_nbt returns the primed TNT or falling block it spawned, so /summon names it from the entity and execute summon has its source.
  • persist.rs, native_falling.rs, game.rs: a falling block takes its id from the entity counter when the server creates it (loaded, summoned, fallen, or from a native mod) instead of when the LAN view next assigns ids, as #6096 does for primed TNT. A summoned one gets a UUID at once, so its compound (and Tags) is kept.
  • scoreboard.rs, native_entities.rs: a falling block is a score holder by UUID, its Tags come from its kept compound, and its id is its entity id.
  • tools/command_exec_corpus.py: the entities group summons a tagged falling block (tag selector, tag … list, data get … BlockState.Name, tp, kill) and a snowball, an egg and an ender pearl (execute if entity, data get … Item.id, kill).

Vanilla reference

  • FallingBlockEntity, Snowball, ThrownEgg and ThrownEnderpearl are ordinary entities: EntitySelector.findEntities finds them like any other, and Entity.kill removes them.
  • FallingBlockEntity.getTypeName: Component.translatable("entity.minecraft.falling_block_type", blockState.getBlock().getName()).

Test

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

entities
main 3adcfcbb3 + the new cases 70/85 match: the 15 falling-block and thrown-item cases fail. Vanilla finds 1 (Killed Falling Sand, Summoned new Falling Sand, …); Horizon finds none.
this branch 85/85 match

The whole corpus (every group) matches with this change: 1456/1456 (run before rebasing onto 3adcfcbb3; the entities group was rerun after it).

Self-check

pr_ready (tools/pr_ready.py --quick on DESKTOP-S9O4938, 5 min 54 s, before the rebase onto 3adcfcbb3, which applied cleanly):

Check Result
Scope ✅ 8 files, +92 −8
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 584 run, FAILED (errors=1, skipped=1)
rustfmt ✅
clippy ✅
tests: horizon-client ❌ 1185 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 ("an airborne stand must fall") fails the same way on 1c47bf7fd without 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/6135 **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/more-selectors` --- ### 📝 Commits (2) - [`0d342f6`](https://github.com/horizon-rust/horizon/commit/0d342f6c729d428d5635cb245c0259e11eaf5e64) Selectors find falling blocks and thrown items - [`e61a51d`](https://github.com/horizon-rust/horizon/commit/e61a51dd3bc4bf3583eb6e0f0d2d7a74a00d42db) Merge main into #6135 (the mod block entity test fix, #6143) ### 📊 Changes **8 files changed** (+92 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -2) 📝 `crates/horizon-client/src/game/commands.rs` (+34 -1) 📝 `crates/horizon-client/src/game/commands/data.rs` (+24 -1) 📝 `crates/horizon-client/src/game/native_entities.rs` (+2 -1) 📝 `crates/horizon-client/src/game/native_falling.rs` (+2 -1) 📝 `crates/horizon-client/src/game/persist.rs` (+5 -2) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+6 -0) 📝 `tools/command_exec_corpus.py` (+15 -0) </details> ### 📄 Description > 🤖 Opened by k3yh's AI agent (Claude Code, Claude Opus 5.5), not by k3yh personally. ## What and why A follow-up to #6096 (selectors find primed TNT). I summoned every entity type Horizon keeps outside the usual lists, ran `execute if entity @e[type=…]` and `kill` on each, and compared with vanilla. These still matched nothing: - **Falling blocks.** They live in `Game::falling`, which the selectors didn't offer. `/summon` also named one "Falling Block"; vanilla says "Falling Sand" (`FallingBlockEntity.getTypeName`, `entity.minecraft.falling_block_type` with the block's name). - **Snowballs, eggs and ender pearls.** They are in the projectile list, but the selector kept only the kinds `/data` could write (arrows, fireballs, wind charges). `entity_nbt::throwable_to_nbt` writes the thrown items already. Firework rockets don't match either, but Horizon has no writer for their NBT yet, so I left them for another PR. `/summon minecraft:ominous_item_spawner` fails outright, which is a different problem. ## 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::Falling(id)`, offered by the selector, with its position, type, level lookup, `/tp`, `/kill` and its name ("Falling <block>"). The projectile filter also lets through what `entity_nbt::saved_with_chunk` saves, which adds the thrown items. - `commands/data.rs`: `/data get entity` writes a falling block with `falling_block_to_nbt` and its kept compound (as the chunk save does), and a thrown item with `throwable_to_nbt`. `spawn_entity_from_nbt` returns the primed TNT or falling block it spawned, so `/summon` names it from the entity and `execute summon` has its source. - `persist.rs`, `native_falling.rs`, `game.rs`: a falling block takes its id from the entity counter when the server creates it (loaded, summoned, fallen, or from a native mod) instead of when the LAN view next assigns ids, as #6096 does for primed TNT. A summoned one gets a UUID at once, so its compound (and `Tags`) is kept. - `scoreboard.rs`, `native_entities.rs`: a falling block is a score holder by UUID, its `Tags` come from its kept compound, and its id is its entity id. - `tools/command_exec_corpus.py`: the `entities` group summons a tagged falling block (tag selector, `tag … list`, `data get … BlockState.Name`, `tp`, `kill`) and a snowball, an egg and an ender pearl (`execute if entity`, `data get … Item.id`, `kill`). ## Vanilla reference - `FallingBlockEntity`, `Snowball`, `ThrownEgg` and `ThrownEnderpearl` are ordinary entities: `EntitySelector.findEntities` finds them like any other, and `Entity.kill` removes them. - `FallingBlockEntity.getTypeName`: `Component.translatable("entity.minecraft.falling_block_type", blockState.getBlock().getName())`. ## Test `tools/test_command_exec_parity.py`, which runs each command on vanilla's real implementations and on Horizon: | | entities | |---|---| | main 3adcfcbb3 + the new cases | 70/85 match: the 15 falling-block and thrown-item cases fail. Vanilla finds 1 (`Killed Falling Sand`, `Summoned new Falling Sand`, …); Horizon finds none. | | this branch | 85/85 match | The whole corpus (every group) matches with this change: 1456/1456 (run before rebasing onto 3adcfcbb3; the `entities` group was rerun after it). ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on DESKTOP-S9O4938, 5 min 54 s, before the rebase onto 3adcfcbb3, which applied cleanly): | Check | Result | | --- | --- | | Scope | ✅ 8 files, +92 −8 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 584 run, FAILED (errors=1, skipped=1) | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client | ❌ 1185 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` ("an airborne stand must fall") fails the same way on 1c47bf7fd without 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:45 +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#6672
No description provided.