[PR #4724] [MERGED] Test instance block: entity, packets, actions, edit screen and renderer #5806

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

📋 Pull Request Information

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

Base: main ← Head: parity/A4b-test-instance


📝 Commits (2)

  • 3119211 Test instance block: block entity, packets, handler, edit screen, renderer
  • 5f06dbb Merge remote-tracking branch 'hr/main' into parity/A4b-test-instance

📊 Changes

20 files changed (+1531 additions, -44 deletions)

View changed files

📝 crates/horizon-client-render/src/chunk/block_entity.rs (+2 -0)
📝 crates/horizon-client-render/src/containers.rs (+7 -0)
📝 crates/horizon-client-render/src/lib.rs (+1 -0)
➕ crates/horizon-client-render/src/test_instance_block.rs (+265 -0)
📝 crates/horizon-client/src/game.rs (+13 -3)
📝 crates/horizon-client/src/game/beacon.rs (+41 -1)
📝 crates/horizon-client/src/game/block_editor.rs (+97 -1)
📝 crates/horizon-client/src/game/lan_actions.rs (+27 -0)
📝 crates/horizon-client/src/game/remote.rs (+5 -1)
📝 crates/horizon-client/src/game/structure_blocks.rs (+84 -34)
➕ crates/horizon-client/src/game/test_instance_edit.rs (+412 -0)
➕ crates/horizon-client/src/game/test_instances.rs (+481 -0)
📝 crates/horizon-client/src/lan/chunks.rs (+2 -0)
📝 crates/horizon-client/src/lib.rs (+2 -2)
📝 crates/horizon-client/src/save.rs (+2 -0)
📝 crates/horizon-protocol/src/buf.rs (+12 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+63 -1)
📝 crates/horizon-world/src/level/classes.rs (+1 -0)
📝 crates/horizon-world/src/level/interact.rs (+5 -1)
📝 crates/horizon-world/src/worldgen/structure.rs (+9 -0)

📄 Description

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

Part of #3520, part of #3518, part of #3519 (stage 4b of the structure/jigsaw/test block project: the test instance block). Larger than 500 lines: the entity, packets, handler, screen and renderer only work together.

What and why

Test instance blocks had no block entity, editor, actions or markers.

  • TestInstanceBlockEntity (Data codec with test, size, rotation, ignore entities, status, error message; error markers; getStructureBoundingBox, getStartCorner, getRenderableBox).
  • ServerboundTestInstanceBlockActionPacket and ClientboundTestInstanceBlockStatus in horizon-protocol (ids 65 and 129, Data.STREAM_CODEC).
  • ServerGamePacketListenerImpl.handleTestInstanceBlockAction: game masters only; INIT/QUERY answer with the test's description and (QUERY) its structure's size; SET stores the data; RESET (resetTest: remove barriers, clear markers, placeStructure with the cleared space, status CLEARED), SAVE (saveTest: the structure saved from the world, air ignored) and EXPORT (exportTest: saves, then the "disabled" message a non-development build gives). The tests are read from data/<namespace>/test_instance/<path>.json.
  • TestInstanceBlockEditScreen: vanilla layout (id, info, size, rotation, entities, reset/save/run/done/cancel), the QUERY on each id edit, status text (with a failed test's message), size fill, save gated on rotation NONE and a valid id. The shared edit-screen runner gained an info widget and open/edit/status hooks.
  • TestInstanceRenderer.extractRenderState/submit: the beacon beam (grey running, green pass, red required fail, orange optional fail) on the existing beacon beams, the box through the bounding-box gizmos, and the error markers.

Not done, and why:

  • RUN checks the test and structure (vanilla's two error messages) and places the structure, but does not start the test: Horizon has no game test runner (GameTestRunner, GameTestInfo, TestCommand.trackAndStartRunner).
  • Error markers are drawn as red box outlines: the gizmo pipeline has no filled boxes or world-space text, so the fill and the marker text (submitErrorMarker's billboardText) are missing.
  • Entities in the test area are not removed on reset (removeEntities, clearSpaceForStructure's entity discard) and chunks are not force-loaded.
  • The export button (SharedConstants.IS_RUNNING_IN_IDE) is not shown. Test instances from world data packs are not read, only the game's own.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

TestInstanceBlockEntity.*, handleTestInstanceBlockAction, ServerboundTestInstanceBlockActionPacket, ClientboundTestInstanceBlockStatus, TestInstanceBlockEditScreen, TestInstanceRenderer, GameTestInstance.describe, StructureUtils.clearSpaceForStructure, TestInstanceBlock.useWithoutItem.

Tests

test_instance_block::tests (save/load, boxes), test_instance_packets_round_trip, game::test_instance_edit and game::test_instances tests. fmt and clippy -D warnings clean on horizon-client, horizon-world, horizon-client-render and horizon-protocol.

🤖 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/4724 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `parity/A4b-test-instance` --- ### 📝 Commits (2) - [`3119211`](https://github.com/horizon-rust/horizon/commit/31192110c61d4adfb420f95e6a38bc26e9cbe15d) Test instance block: block entity, packets, handler, edit screen, renderer - [`5f06dbb`](https://github.com/horizon-rust/horizon/commit/5f06dbbc16b0561243310a96e7b0aaeb18528be3) Merge remote-tracking branch 'hr/main' into parity/A4b-test-instance ### 📊 Changes **20 files changed** (+1531 additions, -44 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/chunk/block_entity.rs` (+2 -0) 📝 `crates/horizon-client-render/src/containers.rs` (+7 -0) 📝 `crates/horizon-client-render/src/lib.rs` (+1 -0) ➕ `crates/horizon-client-render/src/test_instance_block.rs` (+265 -0) 📝 `crates/horizon-client/src/game.rs` (+13 -3) 📝 `crates/horizon-client/src/game/beacon.rs` (+41 -1) 📝 `crates/horizon-client/src/game/block_editor.rs` (+97 -1) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+27 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+5 -1) 📝 `crates/horizon-client/src/game/structure_blocks.rs` (+84 -34) ➕ `crates/horizon-client/src/game/test_instance_edit.rs` (+412 -0) ➕ `crates/horizon-client/src/game/test_instances.rs` (+481 -0) 📝 `crates/horizon-client/src/lan/chunks.rs` (+2 -0) 📝 `crates/horizon-client/src/lib.rs` (+2 -2) 📝 `crates/horizon-client/src/save.rs` (+2 -0) 📝 `crates/horizon-protocol/src/buf.rs` (+12 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+63 -1) 📝 `crates/horizon-world/src/level/classes.rs` (+1 -0) 📝 `crates/horizon-world/src/level/interact.rs` (+5 -1) 📝 `crates/horizon-world/src/worldgen/structure.rs` (+9 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Sonnet 5.5), not by levzzz5154 personally. Part of #3520, part of #3518, part of #3519 (stage 4b of the structure/jigsaw/test block project: the test instance block). Larger than 500 lines: the entity, packets, handler, screen and renderer only work together. ## What and why Test instance blocks had no block entity, editor, actions or markers. - `TestInstanceBlockEntity` (`Data` codec with test, size, rotation, ignore entities, status, error message; error markers; `getStructureBoundingBox`, `getStartCorner`, `getRenderableBox`). - `ServerboundTestInstanceBlockActionPacket` and `ClientboundTestInstanceBlockStatus` in horizon-protocol (ids 65 and 129, `Data.STREAM_CODEC`). - `ServerGamePacketListenerImpl.handleTestInstanceBlockAction`: game masters only; INIT/QUERY answer with the test's description and (QUERY) its structure's size; SET stores the data; RESET (`resetTest`: remove barriers, clear markers, `placeStructure` with the cleared space, status CLEARED), SAVE (`saveTest`: the structure saved from the world, air ignored) and EXPORT (`exportTest`: saves, then the "disabled" message a non-development build gives). The tests are read from `data/<namespace>/test_instance/<path>.json`. - `TestInstanceBlockEditScreen`: vanilla layout (id, info, size, rotation, entities, reset/save/run/done/cancel), the QUERY on each id edit, status text (with a failed test's message), size fill, save gated on rotation NONE and a valid id. The shared edit-screen runner gained an info widget and open/edit/status hooks. - `TestInstanceRenderer.extractRenderState/submit`: the beacon beam (grey running, green pass, red required fail, orange optional fail) on the existing beacon beams, the box through the bounding-box gizmos, and the error markers. Not done, and why: - `RUN` checks the test and structure (vanilla's two error messages) and places the structure, but does not start the test: Horizon has no game test runner (`GameTestRunner`, `GameTestInfo`, `TestCommand.trackAndStartRunner`). - Error markers are drawn as red box outlines: the gizmo pipeline has no filled boxes or world-space text, so the fill and the marker text (`submitErrorMarker`'s `billboardText`) are missing. - Entities in the test area are not removed on reset (`removeEntities`, `clearSpaceForStructure`'s entity discard) and chunks are not force-loaded. - The export button (`SharedConstants.IS_RUNNING_IN_IDE`) is not shown. Test instances from world data packs are not read, only the game's own. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference `TestInstanceBlockEntity.*`, `handleTestInstanceBlockAction`, `ServerboundTestInstanceBlockActionPacket`, `ClientboundTestInstanceBlockStatus`, `TestInstanceBlockEditScreen`, `TestInstanceRenderer`, `GameTestInstance.describe`, `StructureUtils.clearSpaceForStructure`, `TestInstanceBlock.useWithoutItem`. ## Tests `test_instance_block::tests` (save/load, boxes), `test_instance_packets_round_trip`, `game::test_instance_edit` and `game::test_instances` tests. fmt and clippy `-D warnings` clean on horizon-client, horizon-world, horizon-client-render and horizon-protocol. 🤖 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 05:15:08 +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#5806
No description provided.