[PR #6282] [MERGED] Summon and select ominous item spawners #6764

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

📋 Pull Request Information

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

Base: main ← Head: fix/ominous-spawner-summon


📝 Commits (1)

  • ebec5ef Summon and select ominous item spawners

📊 Changes

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

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+24 -2)
📝 crates/horizon-client/src/game/commands.rs (+20 -1)
📝 crates/horizon-client/src/game/commands/data.rs (+13 -0)
📝 crates/horizon-client/src/game/lan_entities.rs (+3 -1)
📝 crates/horizon-client/src/game/native_entities.rs (+2 -1)
📝 crates/horizon-client/src/game/ominous_item_spawner.rs (+11 -3)
📝 crates/horizon-client/src/game/scoreboard.rs (+11 -0)
📝 tools/command_exec_corpus.py (+16 -0)

📄 Description

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

What and why

The last entity from the selector check in #6135. /summon minecraft:ominous_item_spawner always answered "Unable to summon entity", and selectors never found a spawner:

  • No item: ominous_item_spawner_from_nbt required one, so a spawner summoned without it (/summon minecraft:ominous_item_spawner, or with only spawn_item_after_ticks) was dropped. Vanilla's readAdditionalSaveData reads item with orElse(ItemStack.EMPTY).
  • With an item: the spawner was created, but spawn_entity_from_nbt didn't know the kind and spawned_mark doesn't count spawners, so /summon still reported the failure.
  • Selectors: spawners live in Game::ominous_spawners, which the selectors didn't offer.

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: a spawner without item loads with minecraft:air, which Horizon already uses for ItemStack.EMPTY (add_remote_ominous_item_spawner). Saving an empty one writes no item: ItemStack.CODEC can't encode EMPTY, so vanilla's store leaves it out. The round-trip test covers it.
  • ominous_item_spawner.rs: spawn_ominous_item returns at once for an empty item, as spawnItem does (no item, no level event 3021, no game event); tickServer still kills the spawner. A spawner takes its id from the entity counter when it is created (summoned, loaded, or dropped by an ominous trial spawner), as #6096 and #6135 do.
  • lan_entities.rs: an empty spawner sends an empty DATA_ITEM.
  • commands.rs, commands/data.rs, scoreboard.rs, native_entities.rs: Target::Spawner(id), offered by the selector, with its position, type, level lookup, /tp, /kill, /data get (ominous_item_spawner_to_nbt), score holder (its own UUID), Tags, and spawn_entity_from_nbt returning it.
  • tools/command_exec_corpus.py: the entities group summons a tagged spawner holding 2 diamonds (tag selector, tag … list, data get of item and spawn_item_after_ticks, tp, kill), an empty one (data get … item fails, as in vanilla), and an empty one with spawn_item_after_ticks:5L, which is gone 10 ticks later and has dropped no item.

Vanilla reference

  • OminousItemSpawner.readAdditionalSaveData: setItem(input.read("item", ItemStack.CODEC).orElse(ItemStack.EMPTY)), spawnItemAfterTicks = input.getLongOr("spawn_item_after_ticks", 0).
  • OminousItemSpawner.spawnItem: returns when getItem().isEmpty(), before the projectile, the item entity, level event 3021 and the game event. tickServer kills the spawner after it either way.
  • Checked in the 26.3 bytecode with javap.

Test

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

entities
main 1bd24e404 + the new cases 87/98 match: all 11 spawner cases fail, from the first summon on ("Unable to summon entity" where vanilla says "Summoned new Ominous Item Spawner").
this branch 98/98 match

The whole corpus (every group) matches: 1469/1469.

The ids now taken at creation leave the rest as it was:

  • tools/test_trial_spawner_parity.py: 2,500 trial spawner cases match vanilla, 234 of them dropping item spawners.
  • tools/test_server_entities_parity.py (a dedicated server tracking entities to a vanilla client): 31 entities identical.

In game (single player, this branch): /summon of a spawner holding 2 diamonds and of an empty one, both with spawn_item_after_ticks:120L, says "Summoned new Ominous Item Spawner" for each, and execute if entity counts 2. The full one floats with its diamond and particles; the empty one shows only the particles. After 120 ticks both are gone, the full one has dropped an item entity of 2 diamonds where it was, and there is no item where the empty one was.

This touches the same lines as #6179 (firework rockets: another Target variant); whichever merges second needs a one-line-per-site rebase.

Self-check

pr_ready (tools/pr_ready.py --quick --base 1bd24e404 on DESKTOP-S9O4938, 5 min 37 s):

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

None of the failures is in this change; each fails the same way on 1bd24e404 without it, on this machine:

  • entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation
  • test_world_input_capture.WorldInputCaptureTests.test_capture_lifecycle (its capture binary exits 101)
  • test_port_ledger cannot import tests.test_class_index

🤖 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/6282 **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/ominous-spawner-summon` --- ### 📝 Commits (1) - [`ebec5ef`](https://github.com/horizon-rust/horizon/commit/ebec5efda847de8b0151e78a2d94af5c9d4f1f9f) Summon and select ominous item spawners ### 📊 Changes **8 files changed** (+100 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+24 -2) 📝 `crates/horizon-client/src/game/commands.rs` (+20 -1) 📝 `crates/horizon-client/src/game/commands/data.rs` (+13 -0) 📝 `crates/horizon-client/src/game/lan_entities.rs` (+3 -1) 📝 `crates/horizon-client/src/game/native_entities.rs` (+2 -1) 📝 `crates/horizon-client/src/game/ominous_item_spawner.rs` (+11 -3) 📝 `crates/horizon-client/src/game/scoreboard.rs` (+11 -0) 📝 `tools/command_exec_corpus.py` (+16 -0) </details> ### 📄 Description > 🤖 Opened by k3yh's AI agent (Claude Code, Claude Opus 5.5), not by k3yh personally. ## What and why The last entity from the selector check in #6135. `/summon minecraft:ominous_item_spawner` always answered "Unable to summon entity", and selectors never found a spawner: - **No `item`**: `ominous_item_spawner_from_nbt` required one, so a spawner summoned without it (`/summon minecraft:ominous_item_spawner`, or with only `spawn_item_after_ticks`) was dropped. Vanilla's `readAdditionalSaveData` reads `item` with `orElse(ItemStack.EMPTY)`. - **With an `item`**: the spawner was created, but `spawn_entity_from_nbt` didn't know the kind and `spawned_mark` doesn't count spawners, so `/summon` still reported the failure. - **Selectors**: spawners live in `Game::ominous_spawners`, which the selectors didn't offer. ## 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`: a spawner without `item` loads with `minecraft:air`, which Horizon already uses for `ItemStack.EMPTY` (`add_remote_ominous_item_spawner`). Saving an empty one writes no `item`: `ItemStack.CODEC` can't encode `EMPTY`, so vanilla's `store` leaves it out. The round-trip test covers it. - `ominous_item_spawner.rs`: `spawn_ominous_item` returns at once for an empty item, as `spawnItem` does (no item, no level event 3021, no game event); `tickServer` still kills the spawner. A spawner takes its id from the entity counter when it is created (summoned, loaded, or dropped by an ominous trial spawner), as #6096 and #6135 do. - `lan_entities.rs`: an empty spawner sends an empty `DATA_ITEM`. - `commands.rs`, `commands/data.rs`, `scoreboard.rs`, `native_entities.rs`: `Target::Spawner(id)`, offered by the selector, with its position, type, level lookup, `/tp`, `/kill`, `/data get` (`ominous_item_spawner_to_nbt`), score holder (its own UUID), `Tags`, and `spawn_entity_from_nbt` returning it. - `tools/command_exec_corpus.py`: the `entities` group summons a tagged spawner holding 2 diamonds (tag selector, `tag … list`, `data get` of `item` and `spawn_item_after_ticks`, `tp`, `kill`), an empty one (`data get … item` fails, as in vanilla), and an empty one with `spawn_item_after_ticks:5L`, which is gone 10 ticks later and has dropped no item. ## Vanilla reference - `OminousItemSpawner.readAdditionalSaveData`: `setItem(input.read("item", ItemStack.CODEC).orElse(ItemStack.EMPTY))`, `spawnItemAfterTicks = input.getLongOr("spawn_item_after_ticks", 0)`. - `OminousItemSpawner.spawnItem`: returns when `getItem().isEmpty()`, before the projectile, the item entity, level event 3021 and the game event. `tickServer` kills the spawner after it either way. - Checked in the 26.3 bytecode with `javap`. ## Test `tools/test_command_exec_parity.py`, which runs each command on vanilla's real implementations and on Horizon: | | entities | |---|---| | main 1bd24e404 + the new cases | 87/98 match: all 11 spawner cases fail, from the first `summon` on ("Unable to summon entity" where vanilla says "Summoned new Ominous Item Spawner"). | | this branch | 98/98 match | The whole corpus (every group) matches: 1469/1469. The ids now taken at creation leave the rest as it was: - `tools/test_trial_spawner_parity.py`: 2,500 trial spawner cases match vanilla, 234 of them dropping item spawners. - `tools/test_server_entities_parity.py` (a dedicated server tracking entities to a vanilla client): 31 entities identical. In game (single player, this branch): `/summon` of a spawner holding 2 diamonds and of an empty one, both with `spawn_item_after_ticks:120L`, says "Summoned new Ominous Item Spawner" for each, and `execute if entity` counts 2. The full one floats with its diamond and particles; the empty one shows only the particles. After 120 ticks both are gone, the full one has dropped an item entity of 2 diamonds where it was, and there is no item where the empty one was. This touches the same lines as #6179 (firework rockets: another `Target` variant); whichever merges second needs a one-line-per-site rebase. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base 1bd24e404` on DESKTOP-S9O4938, 5 min 37 s): | Check | Result | | --- | --- | | Scope | ✅ 8 files, +100 −8 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 586 run, FAILED (errors=2, skipped=1) | | rustfmt | ✅ | | clippy | ✅ | | tests: horizon-client | ❌ 1195 passed, 1 failed | | doc tests | ✅ | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | None of the failures is in this change; each fails the same way on 1bd24e404 without it, on this machine: - `entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation` - `test_world_input_capture.WorldInputCaptureTests.test_capture_lifecycle` (its capture binary exits 101) - `test_port_ledger` cannot import `tests.test_class_index` 🤖 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:26:16 +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#6764
No description provided.