[PR #2996] [MERGED] fix(client): book text runs and copies its click commands and shows its hover text #4747

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2996
Author: @feeldev12
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: feat/book-click-events


📝 Commits (3)

  • d480ce2 fix(client): book text runs and copies its click commands and shows its hover text
  • 40c1ab8 Merge remote-tracking branch 'origin/main' into upd/2996
  • 7c31259 Books: suggest_command does nothing on a book, as vanilla's insertText there (every click event is matched)

📊 Changes

2 files changed (+27 additions, -12 deletions)

View changed files

📝 crates/horizon-client/src/game/books.rs (+26 -11)
📝 crates/horizon-client/src/game/chat.rs (+1 -1)

📄 Description

What and why

Fixes #2999: Hypixel's terms-and-conditions book couldn't be accepted, since its Accept/Decline are run_command clicks.

A written book's click events only turned pages and opened links. Servers' rule books and menus use the other actions too, and their hover text never showed:

  • run_command closes the book and runs the command (on a lectern the container is closed on the server first).
  • copy_to_clipboard copies its value and leaves the book open.
  • suggest_command does nothing, as in vanilla (it no longer falls into a silent catch-all by accident: it is explicit now).
  • Hover: the hovered words' show_text hover event shows as a tooltip, wrapped as the chat's is (reuses wrapped_rows and draw_tooltip_lines). book_link_at now goes through a book_style_at that returns the whole style.

Vanilla reference

  • BookViewScreen.handleClickEvent: ChangePage → forcePage(page - 1); RunCommand → closeContainerOnServer() then clickCommandAction(player, command, null) (sendUnattendedCommand with no screen after it, so the book closes); everything else → Screen.defaultHandleGameClickEvent.
  • Screen.defaultHandleClickEvent: CopyToClipboard → keyboardHandler.setClipboard(value) and the screen stays; SuggestCommand → activeScreen.insertText(command, true), which BookViewScreen doesn't override (a no-op).
  • BookViewScreen.extractRenderState → visitText(graphics.textRenderer(HoveredTextEffects.TOOLTIP_AND_CURSOR), false).

No harness: client screen behaviour; there are no book screen tests to extend yet.

Self-check

cargo fmt and cargo check -p horizon-client are clean. I didn't run the full pr_ready.py locally (it is slow on this machine); CI's verify covers it.


🔄 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/2996 **Author:** [@feeldev12](https://github.com/feeldev12) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `feat/book-click-events` --- ### 📝 Commits (3) - [`d480ce2`](https://github.com/horizon-rust/horizon/commit/d480ce24dda5a22bf665535ffc457f66928621e0) fix(client): book text runs and copies its click commands and shows its hover text - [`40c1ab8`](https://github.com/horizon-rust/horizon/commit/40c1ab898f5fa0f6840f07cd5f70438cd029ee17) Merge remote-tracking branch 'origin/main' into upd/2996 - [`7c31259`](https://github.com/horizon-rust/horizon/commit/7c312593765fd18b0f17d10d9bb6ff6f82fef2eb) Books: suggest_command does nothing on a book, as vanilla's insertText there (every click event is matched) ### 📊 Changes **2 files changed** (+27 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/books.rs` (+26 -11) 📝 `crates/horizon-client/src/game/chat.rs` (+1 -1) </details> ### 📄 Description ## What and why Fixes #2999: Hypixel's terms-and-conditions book couldn't be accepted, since its Accept/Decline are `run_command` clicks. A written book's click events only turned pages and opened links. Servers' rule books and menus use the other actions too, and their hover text never showed: - **`run_command`** closes the book and runs the command (on a lectern the container is closed on the server first). - **`copy_to_clipboard`** copies its value and leaves the book open. - **`suggest_command`** does nothing, as in vanilla (it no longer falls into a silent catch-all by accident: it is explicit now). - **Hover**: the hovered words' `show_text` hover event shows as a tooltip, wrapped as the chat's is (reuses `wrapped_rows` and `draw_tooltip_lines`). `book_link_at` now goes through a `book_style_at` that returns the whole style. ## Vanilla reference - `BookViewScreen.handleClickEvent`: `ChangePage` → `forcePage(page - 1)`; `RunCommand` → `closeContainerOnServer()` then `clickCommandAction(player, command, null)` (`sendUnattendedCommand` with no screen after it, so the book closes); everything else → `Screen.defaultHandleGameClickEvent`. - `Screen.defaultHandleClickEvent`: `CopyToClipboard` → `keyboardHandler.setClipboard(value)` and the screen stays; `SuggestCommand` → `activeScreen.insertText(command, true)`, which `BookViewScreen` doesn't override (a no-op). - `BookViewScreen.extractRenderState` → `visitText(graphics.textRenderer(HoveredTextEffects.TOOLTIP_AND_CURSOR), false)`. No harness: client screen behaviour; there are no book screen tests to extend yet. ## Self-check `cargo fmt` and `cargo check -p horizon-client` are clean. I didn't run the full `pr_ready.py` locally (it is slow on this machine); CI's `verify` covers it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:38 +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#4747
No description provided.