[PR #3225] [MERGED] Dialog: /dialog show and /dialog clear now send the dialog to their targets #4854

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3225
Author: @masa-masa-0314
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ludovic111

Base: main ← Head: fix/dialog-command-packet


📝 Commits (1)

  • 60773a0 Dialog: send the show and clear packets the commands promise

📊 Changes

1 file changed (+76 additions, -12 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/extra.rs (+76 -12)

📄 Description

🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally.

What and why

Fixes #3205. /dialog show and /dialog clear ran, printed "Displayed dialog to X" / "Cleared dialog for X", and told nobody: the state they set (CommandExtras.dialog) was never read, and no code built ClientboundShowDialogPacket or ClearDialogPacket. The client half was already complete — show_play_dialog, clear_dialog, the dialog screen and its actions all exist — so the command could not ever show a dialog, in single player or on a LAN/dedicated server.

The command now does what DialogCommand does: resolve the argument into a Holder<Dialog> (a minecraft:dialog registry entry by index, or the inline dialog as it was sent) and send the packet to every target. The host's own player opens it on the screen; a LAN guest gets the packet through the hub; a guest running the command has it sent to them after their turn, the way /title and friends do.

Vanilla reference

  • net.minecraft.server.dialog.DialogCommand — /dialog show <targets> <dialog> resolves a Holder<Dialog> at parse time and calls ServerPlayer.openDialog(holder) on each target; /dialog clear calls closeDialog().
  • ServerPlayer.openDialog → connection.send(new ClientboundShowDialogPacket(holder)); ServerPlayer.closeDialog → ClientboundClearDialogPacket.
  • ClientboundShowDialogPacket's codec is the Holder<Dialog> one: a registry id + 1, or a 0 then the inline dialog. Horizon's DialogHolder already mirrors it.
  • The inline form is the one that matters in practice: vanilla's minecraft:dialog registry is datapack-only (empty in the 26.3 export), so an id can only resolve where a pack defines dialogs.

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on DESKTOP-3050AHP, against upstream/main at fe84cc07a, 7 min 33 s)

Check Result
Scope ✅ 1 files, +76 −12
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 401 run, FAILED (failures=2, errors=7, skipped=1) (1 min 34 s)
rustfmt ✅ (12 s)
clippy ✅ (1 min 28 s)
tests: horizon-client ❌ 1092 passed, 2 failed (3 min 13 s)
doc tests ✅ 0 passed (1 min 2 s)
Parity ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses

The horizon-client failures are this Windows machine's two pre-existing ones (save::tests::session_lock_is_exclusive, crash::tests::stacks_start_at_the_panicking_frame), which also fail on clean upstream/main here. The Python failures (test_parity_reach, test_port_harness, test_port_publish) are the same on clean upstream/main on this machine — they need the maintainer's horizon-parity tree.

Verified end to end on this machine with the fast build and the control socket:

  • Single player (server-thread, the default): /dialog show @s {type:"minecraft:notice",title:"Hi",body:[{type:"minecraft:plain_message",contents:"Body"}]} opens the dialog (below), and /dialog clear @s closes it again.
  • LAN: after /publish, a second client joined; /dialog show @a … opened the dialog on the host and the guest, and /dialog clear @a closed it on both.

the dialog /dialog show now opens
If the image does not load, open it on GitHub.

Screenshots

The dialog above; no other screen changes.

🤖 Generated with ZCode


🔄 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/3225 **Author:** [@masa-masa-0314](https://github.com/masa-masa-0314) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/dialog-command-packet` --- ### 📝 Commits (1) - [`60773a0`](https://github.com/horizon-rust/horizon/commit/60773a0e92d9a808dfe1a77b9439700367332c0b) Dialog: send the show and clear packets the commands promise ### 📊 Changes **1 file changed** (+76 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/extra.rs` (+76 -12) </details> ### 📄 Description > 🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally. ## What and why Fixes #3205. `/dialog show` and `/dialog clear` ran, printed "Displayed dialog to X" / "Cleared dialog for X", and told nobody: the state they set (`CommandExtras.dialog`) was never read, and no code built `ClientboundShowDialogPacket` or `ClearDialogPacket`. The client half was already complete — `show_play_dialog`, `clear_dialog`, the dialog screen and its actions all exist — so the command could not ever show a dialog, in single player or on a LAN/dedicated server. The command now does what `DialogCommand` does: resolve the argument into a `Holder<Dialog>` (a `minecraft:dialog` registry entry by index, or the inline dialog as it was sent) and send the packet to every target. The host's own player opens it on the screen; a LAN guest gets the packet through the hub; a guest running the command has it sent to them after their turn, the way `/title` and friends do. ## Vanilla reference - `net.minecraft.server.dialog.DialogCommand` — `/dialog show <targets> <dialog>` resolves a `Holder<Dialog>` at parse time and calls `ServerPlayer.openDialog(holder)` on each target; `/dialog clear` calls `closeDialog()`. - `ServerPlayer.openDialog` → `connection.send(new ClientboundShowDialogPacket(holder))`; `ServerPlayer.closeDialog` → `ClientboundClearDialogPacket`. - `ClientboundShowDialogPacket`'s codec is the `Holder<Dialog>` one: a registry id + 1, or a 0 then the inline dialog. Horizon's `DialogHolder` already mirrors it. - The inline form is the one that matters in practice: vanilla's `minecraft:dialog` registry is datapack-only (empty in the 26.3 export), so an id can only resolve where a pack defines dialogs. ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on DESKTOP-3050AHP, against upstream/main at fe84cc07a, 7 min 33 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +76 −12 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 401 run, FAILED (failures=2, errors=7, skipped=1) (1 min 34 s) | | rustfmt | ✅ (12 s) | | clippy | ✅ (1 min 28 s) | | tests: horizon-client | ❌ 1092 passed, 2 failed (3 min 13 s) | | doc tests | ✅ 0 passed (1 min 2 s) | | Parity | ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses | The `horizon-client` failures are this Windows machine's two pre-existing ones (`save::tests::session_lock_is_exclusive`, `crash::tests::stacks_start_at_the_panicking_frame`), which also fail on clean `upstream/main` here. The Python failures (`test_parity_reach`, `test_port_harness`, `test_port_publish`) are the same on clean `upstream/main` on this machine — they need the maintainer's `horizon-parity` tree. Verified end to end on this machine with the fast build and the control socket: - Single player (server-thread, the default): `/dialog show @s {type:"minecraft:notice",title:"Hi",body:[{type:"minecraft:plain_message",contents:"Body"}]}` opens the dialog (below), and `/dialog clear @s` closes it again. - LAN: after `/publish`, a second client joined; `/dialog show @a …` opened the dialog on the host **and** the guest, and `/dialog clear @a` closed it on both. ![the dialog /dialog show now opens](https://github.com/masa-masa-0314/horizon/blob/pr-screenshots/dialog-show.png?raw=true) <sub>If the image does not load, [open it on GitHub](https://github.com/masa-masa-0314/horizon/blob/pr-screenshots/dialog-show.png).</sub> ## Screenshots The dialog above; no other screen changes. 🤖 Generated with ZCode --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:08:25 +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#4854
No description provided.