[PR #1857] [MERGED] Client: show item lore in tooltips with styled components #3821

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

📋 Pull Request Information

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

Base: main ← Head: fix/item-lore-tooltips


📝 Commits (5)

  • d936033 Show item lore in tooltips with vanilla purple italic styles.
  • 0609fb2 Tooltip: lore after the enchantments, as ItemStack.addDetailsToTooltip
  • 8942d00 Merge remote-tracking branch 'origin/main' into cg14/pr1857
  • 90eda91 Add a lore tooltip harness against ItemLore.addToTooltip.
  • 31e9e2d Merge origin/main into fix/item-lore-tooltips

📊 Changes

9 files changed (+322 additions, -60 deletions)

View changed files

➕ crates/horizon-client/examples/probe/lore_tooltip_fixture.rs (+53 -0)
📝 crates/horizon-client/examples/probe/main.rs (+2 -0)
📝 crates/horizon-client/src/game/beacon.rs (+6 -1)
📝 crates/horizon-client/src/game/loom.rs (+6 -3)
📝 crates/horizon-client/src/game/recipe_book.rs (+16 -5)
📝 crates/horizon-client/src/game/stations.rs (+90 -45)
📝 crates/horizon-client/src/item_tooltip.rs (+50 -6)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLoreTooltipOracle.java (+58 -0)
➕ tools/test_lore_tooltip_parity.py (+41 -0)

📄 Description

🤖 Opened by Joansitoh's AI agent (Cursor), not by Joansitoh.

What and why

Stack tooltips never drew minecraft:lore, so an item from a plugin chest showed its name and nothing underneath. This is the lore part of #1645. Styled item names stay with #1702 and menu titles with #1741.

ItemLore.addToTooltip emits the lines already styled by ComponentUtils.mergeStyles with dark purple italic. A set field on the component, including an explicit false, wins. The tooltip keeps those components as Text and paints them with text_styled. tooltip_display still hides the component.

The lines sit where ItemStack.addDetailsToTooltip puts them: after the container, banner, firework, potion, trim and enchantment lines, and before the attribute modifiers.

Vanilla reference

Read from the prepared 26.3 client jar with javap -c (tools/rea_vanilla.py could not start: REA was not on PATH):

  • net.minecraft.world.item.component.ItemLore.addToTooltip forwards styledLines.
  • ItemLore.lambda$new$0 calls ComponentUtils.mergeStyles with LORE_STYLE.
  • LORE_STYLE is Style.EMPTY.withColor(DARK_PURPLE).withItalic(true).
  • Style.applyTo keeps a set field and fills the rest from the lore style.

Harness: tools/test_lore_tooltip_parity.py (VanillaLoreTooltipOracle, lore_tooltip_fixture). Seven stacks: no lore, a plain line, gold with explicit non-italic, a child colour, two lines, lore hidden by tooltip_display, and underline plus strikethrough.

Self-check

python3 tools/test_lore_tooltip_parity.py after the maintainer's order fix: 7 cases match the pinned client.

python3 tools/pr_ready.py --base origin/main was run on Windows before this harness commit. It did not pass there: the parity runner imports fcntl (absent on Windows), three Python tests need a symlink privilege or Unix paths, Clippy failed in untouched horizon-world aquifer code, and three client tests failed on a Windows file lock. Public tree and doc tests passed. rustfmt failed only on the new fixture; that file now matches rustfmt --check.

Screenshots

None attached. In game, a plugin chest item that showed only its name showed its lore lines after the change.

🤖 Generated with Cursor.


🔄 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/1857 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/item-lore-tooltips` --- ### 📝 Commits (5) - [`d936033`](https://github.com/horizon-rust/horizon/commit/d9360338f655668351008f323e6181baf44ab7d0) Show item lore in tooltips with vanilla purple italic styles. - [`0609fb2`](https://github.com/horizon-rust/horizon/commit/0609fb2bebdc082c335361c3da65a188a8f77ef0) Tooltip: lore after the enchantments, as ItemStack.addDetailsToTooltip - [`8942d00`](https://github.com/horizon-rust/horizon/commit/8942d00ace137ddc8aae91aa2b939af5db067876) Merge remote-tracking branch 'origin/main' into cg14/pr1857 - [`90eda91`](https://github.com/horizon-rust/horizon/commit/90eda915d5dec7d02c929ec867262bfe867d396f) Add a lore tooltip harness against ItemLore.addToTooltip. - [`31e9e2d`](https://github.com/horizon-rust/horizon/commit/31e9e2da978a1bf85a4180ac5f33833300709da2) Merge origin/main into fix/item-lore-tooltips ### 📊 Changes **9 files changed** (+322 additions, -60 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-client/examples/probe/lore_tooltip_fixture.rs` (+53 -0) 📝 `crates/horizon-client/examples/probe/main.rs` (+2 -0) 📝 `crates/horizon-client/src/game/beacon.rs` (+6 -1) 📝 `crates/horizon-client/src/game/loom.rs` (+6 -3) 📝 `crates/horizon-client/src/game/recipe_book.rs` (+16 -5) 📝 `crates/horizon-client/src/game/stations.rs` (+90 -45) 📝 `crates/horizon-client/src/item_tooltip.rs` (+50 -6) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaLoreTooltipOracle.java` (+58 -0) ➕ `tools/test_lore_tooltip_parity.py` (+41 -0) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Cursor), not by Joansitoh. ## What and why Stack tooltips never drew `minecraft:lore`, so an item from a plugin chest showed its name and nothing underneath. This is the lore part of #1645. Styled item names stay with #1702 and menu titles with #1741. `ItemLore.addToTooltip` emits the lines already styled by `ComponentUtils.mergeStyles` with dark purple italic. A set field on the component, including an explicit `false`, wins. The tooltip keeps those components as `Text` and paints them with `text_styled`. `tooltip_display` still hides the component. The lines sit where `ItemStack.addDetailsToTooltip` puts them: after the container, banner, firework, potion, trim and enchantment lines, and before the attribute modifiers. ## Vanilla reference Read from the prepared 26.3 client jar with `javap -c` (`tools/rea_vanilla.py` could not start: REA was not on `PATH`): - `net.minecraft.world.item.component.ItemLore.addToTooltip` forwards `styledLines`. - `ItemLore.lambda$new$0` calls `ComponentUtils.mergeStyles` with `LORE_STYLE`. - `LORE_STYLE` is `Style.EMPTY.withColor(DARK_PURPLE).withItalic(true)`. - `Style.applyTo` keeps a set field and fills the rest from the lore style. Harness: `tools/test_lore_tooltip_parity.py` (`VanillaLoreTooltipOracle`, `lore_tooltip_fixture`). Seven stacks: no lore, a plain line, gold with explicit non-italic, a child colour, two lines, lore hidden by `tooltip_display`, and underline plus strikethrough. ## Self-check `python3 tools/test_lore_tooltip_parity.py` after the maintainer's order fix: 7 cases match the pinned client. `python3 tools/pr_ready.py --base origin/main` was run on Windows before this harness commit. It did not pass there: the parity runner imports `fcntl` (absent on Windows), three Python tests need a symlink privilege or Unix paths, Clippy failed in untouched `horizon-world` aquifer code, and three client tests failed on a Windows file lock. Public tree and doc tests passed. `rustfmt` failed only on the new fixture; that file now matches `rustfmt --check`. ## Screenshots None attached. In game, a plugin chest item that showed only its name showed its lore lines after the change. 🤖 Generated with [Cursor](https://cursor.com). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:34 +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#3821
No description provided.