[GH-ISSUE #3204] Chat: a server's show_dialog click event does nothing #875

Closed
opened 2026-11-02 15:42:32 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @masa-masa-0314 on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3204

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

What happens

A server may put a show_dialog click event on a chat line (or a written book's page). Vanilla opens that dialog when the player clicks the text; Horizon does nothing, because the click event is dropped while the component is parsed.

Reproduction

In a single-player world (or any server), send a component whose click event is show_dialog:

/tellraw @a {"text":"Open dialog","clickEvent":{"action":"show_dialog","dialog":{"type":"minecraft:notice","title":"Hi","body":[{"type":"minecraft:plain_message","contents":"Body"}]}}}

Open chat (T) and click the line.

  • Vanilla 26.3: the dialog screen opens.
  • Horizon: nothing happens.

The same click on a book page (BookViewScreen.handleClickEvent also falls through to Screen.defaultHandleGameClickEvent) does nothing either.

Vanilla reference

  • net.minecraft.network.chat.ClickEvent$Action.SHOW_DIALOG — allowFromServer == true (the enum's static initializer passes iconst_1 for it), so servers may send it; Horizon's own comment on OPEN_FILE already notes that one is the exception.
  • net.minecraft.client.gui.screens.Screen.defaultHandleGameClickEvent handles ClickEvent.ShowDialog → ClientPacketListener.showDialog(holder, screen); everything else goes to defaultHandleClickEvent. Called from ChatScreen.handleComponentClicked and BookViewScreen.handleClickEvent.
  • ClientPacketListener.showDialog resolves the holder (a minecraft:dialog registry entry or an inline dialog) and opens the dialog screen, keeping screen as what Back returns to.

Where it is lost in Horizon

  1. crates/horizon-client-core/src/component.rs — the click-event parse (click_event.action) has arms for open_url, change_page, suggest_command, run_command and copy_to_clipboard only; show_dialog falls into _ => None, so the style arrives with no click event at all. A temporary test confirms it:

    show_dialog click event: None
    open_url click event: Some(OpenUrl("https://example.com"))
    
  2. crates/horizon-client-core/src/text.rs — ClickEvent has no ShowDialog variant, so there is nothing to carry it.

  3. crates/horizon-client/src/game/chat.rs (chat_click) and crates/horizon-client/src/game/books.rs — their match style.click/match click have no arm for it either.

The dialog itself is already implemented client-side: Game::show_dialog_ref / show_dialog in crates/horizon-client/src/game/dialogs.rs take a registry id (Tag::String) or an inline dialog (any other Tag) and open the dialog screen, and dialog.rs's Click::parse already reads a dialog's show_dialog action. Only the text-component path is missing.

Suggested fix

Add a ClickEvent::ShowDialog(Tag) (or a holder-equivalent) variant, parse show_dialog in component.rs from the dialog field, and route it in chat_click and the book click handler to show_dialog_ref (a registry id resolves against the synced minecraft:dialog registry, as show_play_dialog already does).

Originally created by @masa-masa-0314 on GitHub (Oct 28, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3204 > 🤖 Opened by masa-masa-0314's AI agent (ZCode), not by masa-masa-0314 personally. ## What happens A server may put a `show_dialog` click event on a chat line (or a written book's page). Vanilla opens that dialog when the player clicks the text; Horizon does nothing, because the click event is dropped while the component is parsed. ## Reproduction In a single-player world (or any server), send a component whose click event is `show_dialog`: ``` /tellraw @a {"text":"Open dialog","clickEvent":{"action":"show_dialog","dialog":{"type":"minecraft:notice","title":"Hi","body":[{"type":"minecraft:plain_message","contents":"Body"}]}}} ``` Open chat (`T`) and click the line. - **Vanilla 26.3:** the dialog screen opens. - **Horizon:** nothing happens. The same click on a book page (`BookViewScreen.handleClickEvent` also falls through to `Screen.defaultHandleGameClickEvent`) does nothing either. ## Vanilla reference - `net.minecraft.network.chat.ClickEvent$Action.SHOW_DIALOG` — `allowFromServer == true` (the enum's static initializer passes `iconst_1` for it), so servers may send it; Horizon's own comment on `OPEN_FILE` already notes that one is the exception. - `net.minecraft.client.gui.screens.Screen.defaultHandleGameClickEvent` handles `ClickEvent.ShowDialog` → `ClientPacketListener.showDialog(holder, screen)`; everything else goes to `defaultHandleClickEvent`. Called from `ChatScreen.handleComponentClicked` and `BookViewScreen.handleClickEvent`. - `ClientPacketListener.showDialog` resolves the holder (a `minecraft:dialog` registry entry or an inline dialog) and opens the dialog screen, keeping `screen` as what Back returns to. ## Where it is lost in Horizon 1. `crates/horizon-client-core/src/component.rs` — the click-event parse (`click_event.action`) has arms for `open_url`, `change_page`, `suggest_command`, `run_command` and `copy_to_clipboard` only; `show_dialog` falls into `_ => None`, so the style arrives with no click event at all. A temporary test confirms it: ``` show_dialog click event: None open_url click event: Some(OpenUrl("https://example.com")) ``` 2. `crates/horizon-client-core/src/text.rs` — `ClickEvent` has no `ShowDialog` variant, so there is nothing to carry it. 3. `crates/horizon-client/src/game/chat.rs` (`chat_click`) and `crates/horizon-client/src/game/books.rs` — their `match style.click`/`match click` have no arm for it either. The dialog itself is already implemented client-side: `Game::show_dialog_ref` / `show_dialog` in `crates/horizon-client/src/game/dialogs.rs` take a registry id (`Tag::String`) or an inline dialog (any other `Tag`) and open the dialog screen, and `dialog.rs`'s `Click::parse` already reads a dialog's `show_dialog` action. Only the text-component path is missing. ## Suggested fix Add a `ClickEvent::ShowDialog(Tag)` (or a holder-equivalent) variant, parse `show_dialog` in `component.rs` from the `dialog` field, and route it in `chat_click` and the book click handler to `show_dialog_ref` (a registry id resolves against the synced `minecraft:dialog` registry, as `show_play_dialog` already does).
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#875
No description provided.