[PR #4227] [MERGED] Sync spawner mob previews after block data commands #5501

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4227
Author: @abduvaliy-engineer
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @levzzz5154

Base: main ← Head: fix/spawner-data-sync


📝 Commits (1)

  • 4b14acc Sync block entity data edits to connected clients

📊 Changes

5 files changed (+108 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/data.rs (+3 -0)
➕ docs/media/spawner-data/after-pig.png (+0 -0)
➕ docs/media/spawner-data/after-zombie.png (+0 -0)
➕ docs/media/spawner-data/before.png (+0 -0)
➕ tools/spawner_display_e2e.py (+105 -0)

📄 Description

🤖 Opened by abduvaliy-engineer's AI agent (OpenAI Codex, GPT-6), not by abduvaliy-engineer personally.

What and why

Fixes #4215.

After /data merge block ... {SpawnData:{entity:{id:"minecraft:zombie"}}}, the server has the mob data but connected clients keep an empty or stale spawner preview. set_data_of replaces the block entity and calls world.set with the unchanged state, which neither queues a block update nor marks the chunk modified.

Call the existing mark_block_entity_updated helper after loading the edited NBT. The server then persists the change and sends the block entity's update tag, allowing the existing renderer from #3230 to show the correct miniature mob. This shared block-data path also handles /data modify and /data remove; no extra render call is added.

The new screenshot regression runs a fresh creative world on the normal integrated-server path, changes the same spawner from zombie to pig and back using /data, and checks actual image changes inside the cage. A stone backdrop, zero activation range, and hidden HUD keep the comparison independent of chat and spawner particles.

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

Java Edition 26.3 BlockDataAccessor.setData calls BlockEntity.setChanged and Level.sendBlockUpdated(pos, state, state, 3) after loading the NBT. Verified against the pinned server JAR's bytecode. The existing port-map row is tools/port_map/rest-016.tsv, Game::set_data_of.

Self-check

  • Built the client and ctl with cargo build --locked --offline --profile fast -p horizon-client --bin horizon-client --bin horizon-ctl.
  • tools/spawner_display_e2e.py fails on the unpatched nightly: 2 changed pixels for zombie→pig and 0 for pig→zombie. It passes with this patch: 1,082 changed pixels in each direction. The author also inspected a playable demo with zombie, pig, and skeleton previews before the push.
  • Existing vanilla command-execution parity: python3 tools/test_command_exec_parity.py --only 'blocks and border' — 47/47 commands match.
  • Public-tree and whitespace checks passed, including the screenshot evidence.
  • Port-ledger build could not complete with JAR-only input: its existing source-member lookup raises StopIteration. The relevant vanilla method was inspected directly with JDK 25 javap; no ledger result is claimed.

pr_ready (tools/pr_ready.py --quick --base upstream/main on omarchy, against upstream/main at df583d34a, 2 min 8 s)

Check Result
Scope ✅ 2 files, +108 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 480 passed (28 s)
rustfmt ✅ (5 s)
clippy ✅ (8 s)
tests: horizon-client ✅ 958 passed (1 min 26 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 ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Screenshots

The regression keeps the camera and cage unchanged while editing only the spawn data.

Before: empty cage After: zombie After: pig
Empty spawner Zombie preview Pig preview

🤖 Generated with OpenAI Codex


🔄 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/4227 **Author:** [@abduvaliy-engineer](https://github.com/abduvaliy-engineer) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/spawner-data-sync` --- ### 📝 Commits (1) - [`4b14acc`](https://github.com/horizon-rust/horizon/commit/4b14acc1f6a811bea05f20fd3a63815b0b9e8e02) Sync block entity data edits to connected clients ### 📊 Changes **5 files changed** (+108 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/data.rs` (+3 -0) ➕ `docs/media/spawner-data/after-pig.png` (+0 -0) ➕ `docs/media/spawner-data/after-zombie.png` (+0 -0) ➕ `docs/media/spawner-data/before.png` (+0 -0) ➕ `tools/spawner_display_e2e.py` (+105 -0) </details> ### 📄 Description > 🤖 Opened by abduvaliy-engineer's AI agent (OpenAI Codex, GPT-6), not by abduvaliy-engineer personally. ## What and why Fixes #4215. After `/data merge block ... {SpawnData:{entity:{id:"minecraft:zombie"}}}`, the server has the mob data but connected clients keep an empty or stale spawner preview. `set_data_of` replaces the block entity and calls `world.set` with the unchanged state, which neither queues a block update nor marks the chunk modified. Call the existing `mark_block_entity_updated` helper after loading the edited NBT. The server then persists the change and sends the block entity's update tag, allowing the existing renderer from #3230 to show the correct miniature mob. This shared block-data path also handles `/data modify` and `/data remove`; no extra render call is added. The new screenshot regression runs a fresh creative world on the normal integrated-server path, changes the same spawner from zombie to pig and back using `/data`, and checks actual image changes inside the cage. A stone backdrop, zero activation range, and hidden HUD keep the comparison independent of chat and spawner particles. ## 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 ## Vanilla reference Java Edition 26.3 `BlockDataAccessor.setData` calls `BlockEntity.setChanged` and `Level.sendBlockUpdated(pos, state, state, 3)` after loading the NBT. Verified against the pinned server JAR's bytecode. The existing port-map row is `tools/port_map/rest-016.tsv`, `Game::set_data_of`. ## Self-check - Built the client and ctl with `cargo build --locked --offline --profile fast -p horizon-client --bin horizon-client --bin horizon-ctl`. - `tools/spawner_display_e2e.py` fails on the unpatched nightly: 2 changed pixels for zombie→pig and 0 for pig→zombie. It passes with this patch: 1,082 changed pixels in each direction. The author also inspected a playable demo with zombie, pig, and skeleton previews before the push. - Existing vanilla command-execution parity: `python3 tools/test_command_exec_parity.py --only 'blocks and border'` — 47/47 commands match. - Public-tree and whitespace checks passed, including the screenshot evidence. - Port-ledger build could not complete with JAR-only input: its existing source-member lookup raises `StopIteration`. The relevant vanilla method was inspected directly with JDK 25 `javap`; no ledger result is claimed. **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on omarchy, against upstream/main at df583d34a, 2 min 8 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +108 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 480 passed (28 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (8 s) | | tests: horizon-client | ✅ 958 passed (1 min 26 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 | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | ## Screenshots The regression keeps the camera and cage unchanged while editing only the spawn data. | Before: empty cage | After: zombie | After: pig | | --- | --- | --- | | ![Empty spawner](https://raw.githubusercontent.com/abduvaliy-engineer/horizon/4b14acc1f6a811bea05f20fd3a63815b0b9e8e02/docs/media/spawner-data/before.png) | ![Zombie preview](https://raw.githubusercontent.com/abduvaliy-engineer/horizon/4b14acc1f6a811bea05f20fd3a63815b0b9e8e02/docs/media/spawner-data/after-zombie.png) | ![Pig preview](https://raw.githubusercontent.com/abduvaliy-engineer/horizon/4b14acc1f6a811bea05f20fd3a63815b0b9e8e02/docs/media/spawner-data/after-pig.png) | 🤖 Generated with [OpenAI Codex](https://openai.com/codex/) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:01 +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#5501
No description provided.