[PR #6682] [MERGED] Fix custom click actions in dialog message text #7029

Closed
opened 2026-11-03 06:32:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6682
Author: @xMelonekMaX
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: fix/dialog-text-clicks


📝 Commits (3)

  • 4d3c7c4 fix: handle custom click actions in dialog message text
  • 9335346 Merge origin/main into fix/dialog-text-clicks
  • 42165d4 Merge main into #6682

📊 Changes

7 files changed (+245 additions, -19 deletions)

View changed files

📝 crates/horizon-client-core/src/component.rs (+65 -1)
📝 crates/horizon-client-core/src/text.rs (+14 -2)
📝 crates/horizon-client/src/dialog_screen.rs (+71 -1)
📝 crates/horizon-client/src/game/books.rs (+6 -0)
📝 crates/horizon-client/src/game/chat.rs (+6 -0)
📝 crates/horizon-client/src/game/dialogs.rs (+26 -14)
📝 tools/server_e2e.py (+57 -1)

📄 Description

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

What and why

Server dialogs can contain message components whose text and inline icons carry a custom click event. Horizon discarded that event while decoding the component, so clicking the label did not notify the server. Hovering clickable dialog text also kept the arrow cursor.

Preserve the custom event's identifier and optional payload through component parsing, inheritance and serialization, then dispatch message clicks through the existing dialog action handler. Text and inline icons now share glyph-based hit testing for clicks and the pointing cursor, and text hover tooltips are shown. Custom events are also handled in chat and written books through the same server packet used by vanilla.

The reported reproduction is a Paper multi-action dialog containing a Shop text label with an inline potion sprite and a custom callback, using WAIT_FOR_RESPONSE. The callback should reach the plugin when the player clicks either the text or the icon.

Fixes #6678

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

Inspected the pinned Minecraft Java Edition 26.3 client jar with javap -p -c:

  • ClickEvent.Custom.CODEC and Style.Serializer: custom actions carry an identifier and an optional NBT payload in a component's style.
  • AbstractStringWidget.extractWidgetRenderState and ActiveTextCollector.ClickableStyleFinder.accept: text with a component click handler requests hover effects over styled glyphs.
  • DialogScreen.runAction and DialogScreen.handleDialogClickEvent: a custom message action sends its identifier/payload and applies the dialog's after_action behavior.
  • Screen.defaultHandleGameClickEvent: custom events in ordinary game screens also send the custom click action packet, retaining the active screen.

Extended tools/server_e2e.py with dialog_text: a real vanilla dedicated server sends a multi-action dialog and logs the custom actions received from Horizon. The check covers inherited actions on an inline sprite and text, no action on blank widget space, absent/compound payloads and none, close, wait_for_response behavior. This is a network end-to-end test against vanilla, not a differential test of the vanilla client's cursor rendering.

Other projects' code

none

Verification

Current validation on 93353465f, after merging main 81e528f92:

  • All 53 horizon-client-core tests and all 10 focused horizon-client-lib dialog tests pass.
  • The no-default-features fast build of the game and control tool passes.
  • Focused Clippy for the game library and binary passes with warnings denied, using a consistent toolchain and separate cache.
  • All 598 Python tests, rustfmt and public-tree checks pass in the current self-check.
  • dialog, dialog_text and titles pass together on the current independent branch build against a real local vanilla server, with the client launched offscreen. No container-close correction was added.

The original correction passed all 53 core tests and 10 dialog tests; dialog, dialog_text and titles passed together on an independent branch build. Before the fix, the new text-click regression failed because no custom action reached the server. Those original logs remain available as historical evidence.

The full affected parity matrix has not been run. The network test checks action delivery and screen state, rather than comparing the vanilla client's rendered cursor.

Self-check

pr_ready (tools/pr_ready.py --quick on 192, against origin/main at 81e528f92, 1 min 43 s)

Check Result
Scope ✅ 9 files, +243 −19
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 598 passed (1 min 4 s)
rustfmt ✅ (15 s)
clippy ❌ failed (5 s)
tests: horizon-client, horizon-client-core, horizon-client-lib ❌ failed (9 s)
doc tests ❌ failed (9 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 ➖ 374 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, armor_stand_frost, arrow, arrow_wind_charge, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes and 362 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

This is not a clean full self-check. All 598 Python tests, rustfmt and public-tree checks pass on the updated base. The default-feature Rust checks cannot build without ALSA development metadata (alsa.pc); the runner's Clippy encounters incompatible cached Rust dependencies (E0514). Focused Clippy passes with --no-default-features, a consistent toolchain and a separate cache. The 374 affected parity harnesses were listed, not run.

The runner included two unrelated untracked text files; neither belongs to this PR. The actual diff is seven files, +240/−19, against main 81e528f92. The server end-to-end checks are run separately from this self-check.

Screenshots

Before/after screenshots showing the hover cursor have not been supplied. The automated waiting-screen capture is not a visual proof of the cursor correction.

🤖 Generated with 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/6682 **Author:** [@xMelonekMaX](https://github.com/xMelonekMaX) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/dialog-text-clicks` --- ### 📝 Commits (3) - [`4d3c7c4`](https://github.com/horizon-rust/horizon/commit/4d3c7c4bb6dce4c611407cf08f3af368bc76ad4c) fix: handle custom click actions in dialog message text - [`9335346`](https://github.com/horizon-rust/horizon/commit/93353465f5d641135291283b2d5be622bd71aa12) Merge origin/main into fix/dialog-text-clicks - [`42165d4`](https://github.com/horizon-rust/horizon/commit/42165d4d45bf2038dc7d0b37f3c84968e75919a2) Merge main into #6682 ### 📊 Changes **7 files changed** (+245 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-core/src/component.rs` (+65 -1) 📝 `crates/horizon-client-core/src/text.rs` (+14 -2) 📝 `crates/horizon-client/src/dialog_screen.rs` (+71 -1) 📝 `crates/horizon-client/src/game/books.rs` (+6 -0) 📝 `crates/horizon-client/src/game/chat.rs` (+6 -0) 📝 `crates/horizon-client/src/game/dialogs.rs` (+26 -14) 📝 `tools/server_e2e.py` (+57 -1) </details> ### 📄 Description > 🤖 Opened by xMelonekMaX's AI agent (Codex, GPT-6), not by xMelonekMaX personally. ## What and why Server dialogs can contain message components whose text and inline icons carry a `custom` click event. Horizon discarded that event while decoding the component, so clicking the label did not notify the server. Hovering clickable dialog text also kept the arrow cursor. Preserve the custom event's identifier and optional payload through component parsing, inheritance and serialization, then dispatch message clicks through the existing dialog action handler. Text and inline icons now share glyph-based hit testing for clicks and the pointing cursor, and text hover tooltips are shown. Custom events are also handled in chat and written books through the same server packet used by vanilla. The reported reproduction is a Paper multi-action dialog containing a `Shop` text label with an inline potion sprite and a custom callback, using `WAIT_FOR_RESPONSE`. The callback should reach the plugin when the player clicks either the text or the icon. Fixes #6678 ## 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 Inspected the pinned Minecraft Java Edition 26.3 client jar with `javap -p -c`: - `ClickEvent.Custom.CODEC` and `Style.Serializer`: custom actions carry an identifier and an optional NBT payload in a component's style. - `AbstractStringWidget.extractWidgetRenderState` and `ActiveTextCollector.ClickableStyleFinder.accept`: text with a component click handler requests hover effects over styled glyphs. - `DialogScreen.runAction` and `DialogScreen.handleDialogClickEvent`: a custom message action sends its identifier/payload and applies the dialog's `after_action` behavior. - `Screen.defaultHandleGameClickEvent`: custom events in ordinary game screens also send the custom click action packet, retaining the active screen. Extended `tools/server_e2e.py` with `dialog_text`: a real vanilla dedicated server sends a multi-action dialog and logs the custom actions received from Horizon. The check covers inherited actions on an inline sprite and text, no action on blank widget space, absent/compound payloads and `none`, `close`, `wait_for_response` behavior. This is a network end-to-end test against vanilla, not a differential test of the vanilla client's cursor rendering. ## Other projects' code none ## Verification Current validation on `93353465f`, after merging main `81e528f92`: - All 53 `horizon-client-core` tests and all 10 focused `horizon-client-lib` dialog tests pass. - The no-default-features fast build of the game and control tool passes. - Focused Clippy for the game library and binary passes with warnings denied, using a consistent toolchain and separate cache. - All 598 Python tests, rustfmt and public-tree checks pass in the current self-check. - `dialog`, `dialog_text` and `titles` pass together on the current independent branch build against a real local vanilla server, with the client launched offscreen. No container-close correction was added. The original correction passed all 53 core tests and 10 dialog tests; `dialog`, `dialog_text` and `titles` passed together on an independent branch build. Before the fix, the new text-click regression failed because no custom action reached the server. Those original logs remain available as historical evidence. The full affected parity matrix has not been run. The network test checks action delivery and screen state, rather than comparing the vanilla client's rendered cursor. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on 192, against origin/main at 81e528f92, 1 min 43 s) | Check | Result | | --- | --- | | Scope | ✅ 9 files, +243 −19 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 598 passed (1 min 4 s) | | rustfmt | ✅ (15 s) | | clippy | ❌ failed (5 s) | | tests: horizon-client, horizon-client-core, horizon-client-lib | ❌ failed (9 s) | | doc tests | ❌ failed (9 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 | ➖ 374 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, armor_stand_frost, arrow, arrow_wind_charge, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes and 362 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | This is not a clean full self-check. All 598 Python tests, rustfmt and public-tree checks pass on the updated base. The default-feature Rust checks cannot build without ALSA development metadata (`alsa.pc`); the runner's Clippy encounters incompatible cached Rust dependencies (E0514). Focused Clippy passes with `--no-default-features`, a consistent toolchain and a separate cache. The 374 affected parity harnesses were listed, not run. The runner included two unrelated untracked text files; neither belongs to this PR. The actual diff is seven files, +240/−19, against main `81e528f92`. The server end-to-end checks are run separately from this self-check. ## Screenshots Before/after screenshots showing the hover cursor have not been supplied. The automated waiting-screen capture is not a visual proof of the cursor correction. 🤖 Generated with [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 06:32:23 +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#7029
No description provided.