[PR #3341] [MERGED] Client: preserve styled item names and text shadow colors #4913

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3341
Author: @damnurmum
Created: 10/28/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: fix/rich-item-name-colors


📝 Commits (9)

  • 2ae5640 Preserve styled item names and component shadow colors
  • c01f4f6 Merge main into rich item name colors
  • be2d358 Keep rich item names in inventory sync and match shadow channel floors
  • 8c739d2 Merge main into rich item names and shadows
  • 0d0411f Merge latest main into rich item names and shadows
  • 5fb9092 Merge main into #3341: inline objects (#3327) beside the component shadow colour
  • 6da84cf A plain custom name is saved as a string, as vanilla's codec writes it
  • d527059 Merge remote-tracking branch 'origin/main' into fix/pt3-3341
  • 9bba721 Merge main into #3341: main's new held-item tests set a Tag custom name

📊 Changes

24 files changed (+435 additions, -73 deletions)

View changed files

📝 crates/horizon-client-core/src/component.rs (+40 -0)
📝 crates/horizon-client-core/src/scoreboard.rs (+1 -0)
📝 crates/horizon-client-core/src/text.rs (+8 -1)
📝 crates/horizon-client-render/src/hud.rs (+79 -6)
📝 crates/horizon-client/examples/probe/tooltip_display_fixture.rs (+30 -0)
📝 crates/horizon-client/src/banner.rs (+2 -1)
📝 crates/horizon-client/src/entity_nbt.rs (+13 -5)
📝 crates/horizon-client/src/game/commands.rs (+2 -2)
📝 crates/horizon-client/src/game/commands/effects.rs (+3 -4)
📝 crates/horizon-client/src/game/commands/items.rs (+1 -1)
📝 crates/horizon-client/src/game/names.rs (+1 -1)
📝 crates/horizon-client/src/game/spill.rs (+2 -1)
📝 crates/horizon-client/src/game/stations.rs (+2 -8)
📝 crates/horizon-client/src/game/titles.rs (+5 -5)
📝 crates/horizon-client/src/item_sync.rs (+2 -2)
📝 crates/horizon-client/src/item_tooltip.rs (+46 -2)
📝 crates/horizon-client/src/lan/guest.rs (+28 -2)
📝 crates/horizon-client/src/menu.rs (+2 -1)
📝 crates/horizon-client/src/menu/place.rs (+1 -1)
📝 crates/horizon-client/src/mobs.rs (+2 -2)

...and 4 more files

📄 Description

🤖 Opened by contributor damnurmum's AI agent (OpenAI Codex), not by the contributor personally.

Summary

Keep minecraft:custom_name as its original text component in StackData, and derive the plain name only where gameplay needs it. This preserves child colours, gradients, and explicit styles through item decoding, saving, renaming, tooltips, held-item labels, and item links in chat. Parse, inherit, serialize, and render shadow_color for text components, including 0 to suppress a shadow.

Relationship to #1702 and #3327

This is an alternative to draft #1702 for styled item names. It addresses the maintainer's single-source-of-truth concern by storing only the original name tag, with no separately mutable plain-name field. It uses the current tooltip renderer without adding a new per-frame line-copy path. The Java/Rust parity fixture format is adapted from #1702 by @RVZO6; this PR adds four cases focused on gradients and style inheritance.

The public ItemStack::custom_name() accessor now returns Option<String> because a plain name must be derived from a structured component. Existing game call sites are updated. PR #3327 also changes hud.rs for inline objects; whichever PR lands second may need a small rebase in text_styled.

Verification

Unit tests cover exact component round trips after a rename, gradient spans and italic: false, RGB shadow colours, shadow suppression, and glyph colours. The Java/Rust tooltip parity harness now includes styled names; local vanilla parity was unavailable because the pinned 26.3 client JAR is not installed here.

pr_ready (tools/pr_ready.py --quick on MacBook-Air-Pavel, against origin/main at a3acb5f0d, 2 min 16 s)

Check Result
Scope ✅ 23 files, +308 −65
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 402 passed (29 s)
rustfmt ✅ (4 s)
clippy ✅ (34 s)
tests: horizon-client, horizon-client-core, horizon-items ✅ 1352 passed (51 s)
doc tests ✅ 0 passed (18 s)
content root tests ✅ 5 passed
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The shadow_color behaviour follows Minecraft Java 1.21.4's text component specification.

🤖 Generated with OpenAI 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/3341 **Author:** [@damnurmum](https://github.com/damnurmum) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/rich-item-name-colors` --- ### 📝 Commits (9) - [`2ae5640`](https://github.com/horizon-rust/horizon/commit/2ae564070432d5c1178d142fa973c79adae0fb2f) Preserve styled item names and component shadow colors - [`c01f4f6`](https://github.com/horizon-rust/horizon/commit/c01f4f646b0ae9d73877103df94d3bf8ea8f3ba9) Merge main into rich item name colors - [`be2d358`](https://github.com/horizon-rust/horizon/commit/be2d3582e77f33176e632e49d4ca18a2bd21c14c) Keep rich item names in inventory sync and match shadow channel floors - [`8c739d2`](https://github.com/horizon-rust/horizon/commit/8c739d2bc2a3c2f1ac97c4fa000200ad2883dafc) Merge main into rich item names and shadows - [`0d0411f`](https://github.com/horizon-rust/horizon/commit/0d0411fc7a1767539456cc050bef56664417c56d) Merge latest main into rich item names and shadows - [`5fb9092`](https://github.com/horizon-rust/horizon/commit/5fb90920730b14b4d977731c392f31e36add9ced) Merge main into #3341: inline objects (#3327) beside the component shadow colour - [`6da84cf`](https://github.com/horizon-rust/horizon/commit/6da84cf1951426a6b5543feadaccfad79fb0ead0) A plain custom name is saved as a string, as vanilla's codec writes it - [`d527059`](https://github.com/horizon-rust/horizon/commit/d52705984a3065add005135f48515323bdf6c6d8) Merge remote-tracking branch 'origin/main' into fix/pt3-3341 - [`9bba721`](https://github.com/horizon-rust/horizon/commit/9bba7215f5ecd1611ad78d831cd0777b34f1cfef) Merge main into #3341: main's new held-item tests set a Tag custom name ### 📊 Changes **24 files changed** (+435 additions, -73 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-core/src/component.rs` (+40 -0) 📝 `crates/horizon-client-core/src/scoreboard.rs` (+1 -0) 📝 `crates/horizon-client-core/src/text.rs` (+8 -1) 📝 `crates/horizon-client-render/src/hud.rs` (+79 -6) 📝 `crates/horizon-client/examples/probe/tooltip_display_fixture.rs` (+30 -0) 📝 `crates/horizon-client/src/banner.rs` (+2 -1) 📝 `crates/horizon-client/src/entity_nbt.rs` (+13 -5) 📝 `crates/horizon-client/src/game/commands.rs` (+2 -2) 📝 `crates/horizon-client/src/game/commands/effects.rs` (+3 -4) 📝 `crates/horizon-client/src/game/commands/items.rs` (+1 -1) 📝 `crates/horizon-client/src/game/names.rs` (+1 -1) 📝 `crates/horizon-client/src/game/spill.rs` (+2 -1) 📝 `crates/horizon-client/src/game/stations.rs` (+2 -8) 📝 `crates/horizon-client/src/game/titles.rs` (+5 -5) 📝 `crates/horizon-client/src/item_sync.rs` (+2 -2) 📝 `crates/horizon-client/src/item_tooltip.rs` (+46 -2) 📝 `crates/horizon-client/src/lan/guest.rs` (+28 -2) 📝 `crates/horizon-client/src/menu.rs` (+2 -1) 📝 `crates/horizon-client/src/menu/place.rs` (+1 -1) 📝 `crates/horizon-client/src/mobs.rs` (+2 -2) _...and 4 more files_ </details> ### 📄 Description > 🤖 Opened by contributor damnurmum's AI agent (OpenAI Codex), not by the contributor personally. ## Summary Keep `minecraft:custom_name` as its original text component in `StackData`, and derive the plain name only where gameplay needs it. This preserves child colours, gradients, and explicit styles through item decoding, saving, renaming, tooltips, held-item labels, and item links in chat. Parse, inherit, serialize, and render `shadow_color` for text components, including `0` to suppress a shadow. ## Relationship to #1702 and #3327 This is an alternative to draft #1702 for styled item names. It addresses the [maintainer's single-source-of-truth concern](https://github.com/horizon-rust/horizon/pull/1702#issuecomment-6393821739) by storing only the original name tag, with no separately mutable plain-name field. It uses the current tooltip renderer without adding a new per-frame line-copy path. The Java/Rust parity fixture format is adapted from #1702 by @RVZO6; this PR adds four cases focused on gradients and style inheritance. The public `ItemStack::custom_name()` accessor now returns `Option<String>` because a plain name must be derived from a structured component. Existing game call sites are updated. PR #3327 also changes `hud.rs` for inline objects; whichever PR lands second may need a small rebase in `text_styled`. ## Verification Unit tests cover exact component round trips after a rename, gradient spans and `italic: false`, RGB shadow colours, shadow suppression, and glyph colours. The Java/Rust tooltip parity harness now includes styled names; local vanilla parity was unavailable because the pinned 26.3 client JAR is not installed here. **pr_ready** (`tools/pr_ready.py --quick` on MacBook-Air-Pavel, against origin/main at a3acb5f0d, 2 min 16 s) | Check | Result | | --- | --- | | Scope | ✅ 23 files, +308 −65 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 402 passed (29 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (34 s) | | tests: horizon-client, horizon-client-core, horizon-items | ✅ 1352 passed (51 s) | | doc tests | ✅ 0 passed (18 s) | | content root tests | ✅ 5 passed | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The `shadow_color` behaviour follows [Minecraft Java 1.21.4's text component specification](https://feedback.minecraft.net/hc/en-us/articles/32385811139085-Minecraft-Java-Edition-1-21-4-The-Garden-Awakens). 🤖 Generated with [OpenAI 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 05:08:52 +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#4913
No description provided.