[PR #6430] [MERGED] A stack's rarity component sets the colour of its name #6867

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6430
Author: @breachato
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/6405-tooltip-lore-rarity


📝 Commits (1)

  • 2a2a749 A stack's rarity component sets the colour of its name

📊 Changes

1 file changed (+35 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/item_tooltip.rs (+35 -2)

📄 Description

🤖 Opened by breachato's AI agent (Claude Code, Claude Opus 5.5), not by breachato personally.

What and why

Part of #6405: the rarity.

/give @a stick[...,rarity=epic,enchantments={aqua_affinity:1},...] showed the stick's name in aqua (rare) instead of magenta (epic).

Vanilla's ItemStack.getRarity reads the stack's own minecraft:rarity component (the item's default unless a command or server set it), then upgrades common/uncommon to rare and rare to epic when enchanted. Horizon's item_tooltip::rarity started from the item's default only (props.rarity), ignoring the component. Both the command path and the network path (item_sync.rs, RARITY → a string) already keep it among the stack's components (StackData::other).

rarity now starts from the stack's minecraft:rarity when it holds a known value, otherwise from the default as before. The ominous banner keeps its uncommon. The callers (the tooltip name colour, [name] links, the item name above the hotbar, a dropped item's spill colour) all go through it.

Unit test: a_stacks_rarity_component_sets_its_rarity (an epic stick stays epic when enchanted; an uncommon sword becomes rare).

Not covered: the lore. The tooltip already draws minecraft:lore (stations.rs, item_tooltip::lore_texts, which accepts list components), and both the command and network paths store it under that key, so I couldn't find from the code why the issue's lore doesn't show. That part is left for someone who can reproduce it in game.

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

  • net.minecraft.world.item.ItemStack.getRarity: the RARITY component, then the enchantment upgrade.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on DESKTOP-G0M27UC, against upstream/main at f4833621f, 8 min 49 s)

Check Result
Scope ✅ 1 files, +35 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 594 passed (2 min 57 s)
rustfmt ✅ (16 s)
clippy ✅ (1 min 53 s)
tests: horizon-client-lib ✅ 1298 passed (3 min 34 s)
doc tests ✅ 0 passed (4 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 ➖ 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)

I see #6434 makes the same rarity change; either one is fine to keep.

🤖 Generated with Claude Code


🔄 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/6430 **Author:** [@breachato](https://github.com/breachato) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/6405-tooltip-lore-rarity` --- ### 📝 Commits (1) - [`2a2a749`](https://github.com/horizon-rust/horizon/commit/2a2a74923183c608707eeb5e472c932ba6a22133) A stack's rarity component sets the colour of its name ### 📊 Changes **1 file changed** (+35 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/item_tooltip.rs` (+35 -2) </details> ### 📄 Description > 🤖 Opened by breachato's AI agent (Claude Code, Claude Opus 5.5), not by breachato personally. ## What and why Part of #6405: the rarity. `/give @a stick[...,rarity=epic,enchantments={aqua_affinity:1},...]` showed the stick's name in aqua (rare) instead of magenta (epic). Vanilla's `ItemStack.getRarity` reads the stack's own `minecraft:rarity` component (the item's default unless a command or server set it), then upgrades common/uncommon to rare and rare to epic when enchanted. Horizon's `item_tooltip::rarity` started from the item's default only (`props.rarity`), ignoring the component. Both the command path and the network path (`item_sync.rs`, `RARITY` → a string) already keep it among the stack's components (`StackData::other`). `rarity` now starts from the stack's `minecraft:rarity` when it holds a known value, otherwise from the default as before. The ominous banner keeps its uncommon. The callers (the tooltip name colour, `[name]` links, the item name above the hotbar, a dropped item's spill colour) all go through it. Unit test: `a_stacks_rarity_component_sets_its_rarity` (an epic stick stays epic when enchanted; an uncommon sword becomes rare). **Not covered: the lore.** The tooltip already draws `minecraft:lore` (`stations.rs`, `item_tooltip::lore_texts`, which accepts list components), and both the command and network paths store it under that key, so I couldn't find from the code why the issue's lore doesn't show. That part is left for someone who can reproduce it in game. ## 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 - `net.minecraft.world.item.ItemStack.getRarity`: the `RARITY` component, then the enchantment upgrade. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on DESKTOP-G0M27UC, against upstream/main at f4833621f, 8 min 49 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +35 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 594 passed (2 min 57 s) | | rustfmt | ✅ (16 s) | | clippy | ✅ (1 min 53 s) | | tests: horizon-client-lib | ✅ 1298 passed (3 min 34 s) | | doc tests | ✅ 0 passed (4 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 | ➖ 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) | I see #6434 makes the same `rarity` change; either one is fine to keep. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:28:24 +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#6867
No description provided.