[PR #1734] [MERGED] Server dialogs: the dialog screen, its buttons and their actions #3726

Closed
opened 2026-11-03 04:11:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1734
Author: @ludovic111
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: feat/server-dialog-screen


📝 Commits (6)

  • 1d90d72 Server dialogs: the packets and the dialog model
  • a7f8650 Server dialogs: the dialog screen, its buttons and their actions
  • 49dd31d Merge origin/main into feat/server-dialogs
  • 330a520 Merge feat/server-dialogs into feat/server-dialog-screen
  • b222dd9 Merge origin/main into feat/server-dialogs
  • a1ffa1a Merge feat/server-dialogs into feat/server-dialog-screen

📊 Changes

12 files changed (+1928 additions, -5 deletions)

View changed files

➕ crates/horizon-client/src/dialog.rs (+794 -0)
➕ crates/horizon-client/src/dialog_screen.rs (+304 -0)
📝 crates/horizon-client/src/game.rs (+23 -2)
📝 crates/horizon-client/src/game/agent.rs (+4 -0)
📝 crates/horizon-client/src/game/control.rs (+7 -0)
➕ crates/horizon-client/src/game/dialogs.rs (+450 -0)
📝 crates/horizon-client/src/game/remote.rs (+8 -0)
📝 crates/horizon-client/src/lib.rs (+2 -0)
📝 crates/horizon-client/src/net.rs (+30 -0)
📝 crates/horizon-protocol/src/packets/configuration.rs (+52 -0)
📝 crates/horizon-protocol/src/packets/play.rs (+60 -3)
➕ tools/server_e2e.py (+194 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Stacked on #1720 (dialog packets and model): its base is feat/server-dialogs. Second of three. The inputs come in feat/server-dialog-inputs.

What players see

When a server shows a dialog (/dialog show, or a plugin such as AuthMe), Horizon now opens it. Before, the game dropped it and the player saw nothing. This covers vanilla's DialogScreen with its title, the warning button, message bodies and action buttons. Inputs come in the next PR; until then they are not drawn and keep their initial values.

Vanilla

  • Layout (DialogScreen.init / repositionElements): a HeaderAndFooterLayout.
    • The header is 33 high. The title and the 20×20 warning button sit 10 apart, centred together.
    • The body is a ScrollableLayout 30 below the header, with 10 reserved on each side. Elements sit in a column 10 apart: FocusableTextWidget, wrapped at width − 8, padding 4, centred.
    • Buttons: MultiButtonDialogScreen packs them into columns 2 apart, with the leftover row centred. Its exit button goes in the footer, or the footer is 5 high. SimpleDialogScreen puts its buttons side by side, 8 apart.
  • Actions (runAction): a custom action goes back as custom_click_action. run_command runs the command in play (in configuration vanilla only logs a warning). show_dialog opens another dialog, by registry id or inline. copy_to_clipboard copies.
    • after_action then closes the screen, leaves it open, or opens WaitingForResponseScreen. That screen's Back shows after 1 s and works after 5 s, and Escape works from then too.
  • Closing. The warning button opens WarningScreen; its Disconnect leaves the server and Back returns to the dialog.
    • Escape runs the cancel action when can_close_with_escape allows it.
    • clear_dialog closes a dialog but not the waiting screen, as in vanilla. The level loading screen and a disconnect close everything.
  • Background. The world and HUD blur behind the dialog, as behind any in-game screen. In configuration, it replaces the connecting screen.

Change

  • dialog_screen.rs: the layout, as pure code with tests (grids, the waiting countdown).
  • game/dialogs.rs: state, drawing, clicks, scrolling and keys. It is wired into game.rs, net.rs (configuration events and send_custom_click in either state) and game/remote.rs.
  • horizon-ctl: state reports dialog (the open dialog's title, body, inputs, buttons and the screen), and the screen label is dialog. key reaches a dialog, in configuration too.
  • tools/server_e2e.py, a new harness: a vanilla 26.3 dedicated server (offline, flat) and one Horizon client. A log4j config makes MinecraftServer's debug lines visible, so a custom click action shows up in the server's log.
    • Check dialog: /dialog show with a multi-action dialog, then:
      • the command button runs trigger answer set 41, and the server reports 41;
      • the custom button's payload reaches the server as {tag:"x"};
      • with after_action none the dialog stays open, and /dialog clear closes it;
      • with wait_for_response the waiting screen opens, and Escape closes it after 5 s.

Evidence

python3 tools/server_e2e.py --check dialog:

  • before (main): FAIL, wait-for screen dialog: timed out after 30 s; the screen is playing
  • after: PASS (trigger: 41, custom: {tag:"x"}, waiting: waiting_for_response)

Self-check

pr_ready (tools/pr_ready.py --base origin/feat/server-dialogs on the Mac mini, 58 min)

Check Result
Scope ⚠️ 9 files, +1021 −2. Over 500: the screen (dialog_screen.rs 304 with tests, game/dialogs.rs 450) and the new harness (≈195) only make sense together. The inputs are split out into the next PR
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ errors=2. The same 2 fail on main on macOS: OracleReuseTests.test_reuses_until_an_input_or_output_changes (fake java exits 127) and ParityRunnerTests.test_report_rejects_sources_changed_during_a_run (/private/var vs /var)
rustfmt / clippy ✅
tests: horizon-client ✅ 1207 passed
Parity ✅ 108 affected, 108 passed

Label feature.

🤖 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/1734 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/server-dialog-screen` --- ### 📝 Commits (6) - [`1d90d72`](https://github.com/horizon-rust/horizon/commit/1d90d72a64418071f943e404166fa39b09f50981) Server dialogs: the packets and the dialog model - [`a7f8650`](https://github.com/horizon-rust/horizon/commit/a7f8650c6b78f140fc0ea8f01bf4f0ecf9387690) Server dialogs: the dialog screen, its buttons and their actions - [`49dd31d`](https://github.com/horizon-rust/horizon/commit/49dd31d36fd43c50a8a9804eeed09264abfaa7c6) Merge origin/main into feat/server-dialogs - [`330a520`](https://github.com/horizon-rust/horizon/commit/330a5205aeebe66bea95fe28b3f77d9dd6af47e4) Merge feat/server-dialogs into feat/server-dialog-screen - [`b222dd9`](https://github.com/horizon-rust/horizon/commit/b222dd91947c136c11252ba7c69187b445bf5f8a) Merge origin/main into feat/server-dialogs - [`a1ffa1a`](https://github.com/horizon-rust/horizon/commit/a1ffa1ac11042074271c2ea9e12f9293ae313aa7) Merge feat/server-dialogs into feat/server-dialog-screen ### 📊 Changes **12 files changed** (+1928 additions, -5 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client/src/dialog.rs` (+794 -0) ➕ `crates/horizon-client/src/dialog_screen.rs` (+304 -0) 📝 `crates/horizon-client/src/game.rs` (+23 -2) 📝 `crates/horizon-client/src/game/agent.rs` (+4 -0) 📝 `crates/horizon-client/src/game/control.rs` (+7 -0) ➕ `crates/horizon-client/src/game/dialogs.rs` (+450 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+8 -0) 📝 `crates/horizon-client/src/lib.rs` (+2 -0) 📝 `crates/horizon-client/src/net.rs` (+30 -0) 📝 `crates/horizon-protocol/src/packets/configuration.rs` (+52 -0) 📝 `crates/horizon-protocol/src/packets/play.rs` (+60 -3) ➕ `tools/server_e2e.py` (+194 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Stacked on #1720** (dialog packets and model): its base is `feat/server-dialogs`. Second of three. The inputs come in `feat/server-dialog-inputs`. ## What players see When a server shows a dialog (`/dialog show`, or a plugin such as AuthMe), Horizon now opens it. Before, the game dropped it and the player saw nothing. This covers vanilla's `DialogScreen` with its title, the warning button, message bodies and action buttons. Inputs come in the next PR; until then they are not drawn and keep their initial values. ## Vanilla - **Layout** (`DialogScreen.init` / `repositionElements`): a `HeaderAndFooterLayout`. - The header is 33 high. The title and the 20×20 warning button sit 10 apart, centred together. - The body is a `ScrollableLayout` 30 below the header, with 10 reserved on each side. Elements sit in a column 10 apart: `FocusableTextWidget`, wrapped at width − 8, padding 4, centred. - Buttons: `MultiButtonDialogScreen` packs them into columns 2 apart, with the leftover row centred. Its exit button goes in the footer, or the footer is 5 high. `SimpleDialogScreen` puts its buttons side by side, 8 apart. - **Actions** (`runAction`): a custom action goes back as `custom_click_action`. `run_command` runs the command in play (in configuration vanilla only logs a warning). `show_dialog` opens another dialog, by registry id or inline. `copy_to_clipboard` copies. - `after_action` then closes the screen, leaves it open, or opens `WaitingForResponseScreen`. That screen's Back shows after 1 s and works after 5 s, and Escape works from then too. - **Closing.** The warning button opens `WarningScreen`; its Disconnect leaves the server and Back returns to the dialog. - Escape runs the cancel action when `can_close_with_escape` allows it. - `clear_dialog` closes a dialog but not the waiting screen, as in vanilla. The level loading screen and a disconnect close everything. - **Background.** The world and HUD blur behind the dialog, as behind any in-game screen. In configuration, it replaces the connecting screen. ## Change - `dialog_screen.rs`: the layout, as pure code with tests (grids, the waiting countdown). - `game/dialogs.rs`: state, drawing, clicks, scrolling and keys. It is wired into `game.rs`, `net.rs` (configuration events and `send_custom_click` in either state) and `game/remote.rs`. - horizon-ctl: `state` reports `dialog` (the open dialog's title, body, inputs, buttons and the screen), and the screen label is `dialog`. `key` reaches a dialog, in configuration too. - `tools/server_e2e.py`, a new harness: a vanilla 26.3 dedicated server (offline, flat) and one Horizon client. A log4j config makes `MinecraftServer`'s debug lines visible, so a custom click action shows up in the server's log. - Check `dialog`: `/dialog show` with a multi-action dialog, then: - the command button runs `trigger answer set 41`, and the server reports 41; - the custom button's payload reaches the server as `{tag:"x"}`; - with `after_action none` the dialog stays open, and `/dialog clear` closes it; - with `wait_for_response` the waiting screen opens, and Escape closes it after 5 s. ## Evidence `python3 tools/server_e2e.py --check dialog`: - before (main): FAIL, `wait-for screen dialog: timed out after 30 s; the screen is playing` - after: PASS (`trigger: 41`, `custom: {tag:"x"}`, `waiting: waiting_for_response`) ## Self-check **pr_ready** (`tools/pr_ready.py --base origin/feat/server-dialogs` on the Mac mini, 58 min) | Check | Result | | --- | --- | | Scope | ⚠️ 9 files, +1021 −2. Over 500: the screen (`dialog_screen.rs` 304 with tests, `game/dialogs.rs` 450) and the new harness (≈195) only make sense together. The inputs are split out into the next PR | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ errors=2. The same 2 fail on `main` on macOS: `OracleReuseTests.test_reuses_until_an_input_or_output_changes` (fake `java` exits 127) and `ParityRunnerTests.test_report_rejects_sources_changed_during_a_run` (`/private/var` vs `/var`) | | rustfmt / clippy | ✅ | | tests: horizon-client | ✅ 1207 passed | | Parity | ✅ 108 affected, 108 passed | Label `feature`. 🤖 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 04:11:46 +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#3726
No description provided.