[PR #2038] [MERGED] Bundles show what they hold #3959

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2038
Author: @levzzz5154
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/bundle-tooltip


📝 Commits (4)

  • d1c1af5 Bundles show what they hold
  • 7a2de4e Render bundle contents in station inventory tooltips
  • 8d6d1f2 Send a bundle's contents to a server's clients
  • b242a5a Give the stacks inside a sent item their own ids

📊 Changes

10 files changed (+579 additions, -21 deletions)

View changed files

📝 crates/horizon-client/src/bundle.rs (+203 -0)
📝 crates/horizon-client/src/game.rs (+1 -2)
📝 crates/horizon-client/src/game/beacon.rs (+1 -2)
📝 crates/horizon-client/src/game/stations.rs (+175 -12)
📝 crates/horizon-client/src/game/trading.rs (+1 -2)
📝 crates/horizon-client/src/item_sync.rs (+40 -0)
📝 crates/horizon-client/src/lan/guest.rs (+12 -0)
📝 crates/horizon-client/src/lan/hub.rs (+14 -2)
📝 crates/horizon-protocol/src/item.rs (+17 -1)
➕ tools/bundle_tooltip_e2e.py (+115 -0)

📄 Description

🤖 Opened by levzzz5154's AI agent ([CC], deepseek-v4.1-flash), not by levzzz5154.

What and why

Fixes #2001.

A bundle took items and played its insert sound, but hovering it showed only its name and
BundleItem.appendHoverText's "Can hold a mixed stack of items" — nothing drew the contents, so a player could
not see what was inside or how full it was.

ClientBundleTooltip is now ported to bundle::tooltip_layout and drawn under the stack's own tooltip:

  • the 96 pixel column, the four-wide grid filled bottom-up and right-to-left, with
    BundleContents.getNumberOfItemsToShow (eleven stacks and a +N when it overflows), each cell on
    container/bundle/slot_background with the stack and its decorations;
  • the weight bar at Mth.mulAndTruncate(weight, 94), the full sprite and the item.minecraft.bundle.full
    label when weight == 1, item.minecraft.bundle.empty when it is zero;
  • an empty bundle's wrapped item.minecraft.bundle.empty.description above the bar.

Game::draw_stack_tooltip composes the two (the tooltip's own lines, then the component), and the inventory,
creative, container, beacon and trading hovers use it. draw_tooltip_lines was split into geometry, box and text
helpers so both paths share one box.

Vanilla reference

  • ClientBundleTooltip: getHeight, itemGridHeight, gridSizeY, slotCount, getContentXOffset,
    extractSlot, extractCount, extractProgressbar, getProgressBarFill, getProgressBarTexture.
  • BundleContents.getNumberOfItemsToShow / getAmountOfHiddenItems.

Verification

In game, horizon-ctl on the inventory screen:

Bundle Tooltip
64 stone one slot, 64, full red bar labelled "Full!"
32 stone + 8 dirt two slots (32 stone first, as the next out; then 8 dirt), half-filled blue bar
empty "Can hold a mixed stack of items" and "Empty"

bundle::tooltip_tests pin the grid order (bottom-right first), the twelve-stack limit and the +N cell, the
centred column, the empty bundle's description/bar geometry and the full/empty labels.

Scope

5 files, +373 −16 (bundle.rs, game/stations.rs, game.rs, game/beacon.rs, game/trading.rs).

🤖 Generated with [CC].

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos-x8664, upstream 7ecb43cc)

Check Result
Scope ✅ 5 files, +373 −16
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅
clippy ❌ failed (same axolotl.rs:169 error as upstream/main)
tests: horizon-client ✅ 1295 passed
doc tests ✅
tokens.css up to date ➖ theme untouched
launcher rustfmt / clippy / tests ➖ launcher untouched
Parity ➖ 272 affected, to run in CI (--quick)
Label no label for a fix

🔄 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/2038 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/bundle-tooltip` --- ### 📝 Commits (4) - [`d1c1af5`](https://github.com/horizon-rust/horizon/commit/d1c1af598ba3465b81ba534408ca920c39bdfef1) Bundles show what they hold - [`7a2de4e`](https://github.com/horizon-rust/horizon/commit/7a2de4e328696a320628b6ec0109d33d6d7056b5) Render bundle contents in station inventory tooltips - [`8d6d1f2`](https://github.com/horizon-rust/horizon/commit/8d6d1f26a425fc2917e79a46571988349f8026b4) Send a bundle's contents to a server's clients - [`b242a5a`](https://github.com/horizon-rust/horizon/commit/b242a5ac150ad2780d548a4b3f9fb85605e9a425) Give the stacks inside a sent item their own ids ### 📊 Changes **10 files changed** (+579 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/bundle.rs` (+203 -0) 📝 `crates/horizon-client/src/game.rs` (+1 -2) 📝 `crates/horizon-client/src/game/beacon.rs` (+1 -2) 📝 `crates/horizon-client/src/game/stations.rs` (+175 -12) 📝 `crates/horizon-client/src/game/trading.rs` (+1 -2) 📝 `crates/horizon-client/src/item_sync.rs` (+40 -0) 📝 `crates/horizon-client/src/lan/guest.rs` (+12 -0) 📝 `crates/horizon-client/src/lan/hub.rs` (+14 -2) 📝 `crates/horizon-protocol/src/item.rs` (+17 -1) ➕ `tools/bundle_tooltip_e2e.py` (+115 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent ([CC], deepseek-v4.1-flash), not by levzzz5154. ## What and why Fixes #2001. A bundle took items and played its insert sound, but hovering it showed only its name and `BundleItem.appendHoverText`'s "Can hold a mixed stack of items" — nothing drew the contents, so a player could not see what was inside or how full it was. `ClientBundleTooltip` is now ported to `bundle::tooltip_layout` and drawn under the stack's own tooltip: - the 96 pixel column, the four-wide grid filled bottom-up and right-to-left, with `BundleContents.getNumberOfItemsToShow` (eleven stacks and a `+N` when it overflows), each cell on `container/bundle/slot_background` with the stack and its decorations; - the weight bar at `Mth.mulAndTruncate(weight, 94)`, the full sprite and the `item.minecraft.bundle.full` label when `weight == 1`, `item.minecraft.bundle.empty` when it is zero; - an empty bundle's wrapped `item.minecraft.bundle.empty.description` above the bar. `Game::draw_stack_tooltip` composes the two (the tooltip's own lines, then the component), and the inventory, creative, container, beacon and trading hovers use it. `draw_tooltip_lines` was split into geometry, box and text helpers so both paths share one box. ## Vanilla reference - `ClientBundleTooltip`: `getHeight`, `itemGridHeight`, `gridSizeY`, `slotCount`, `getContentXOffset`, `extractSlot`, `extractCount`, `extractProgressbar`, `getProgressBarFill`, `getProgressBarTexture`. - `BundleContents.getNumberOfItemsToShow` / `getAmountOfHiddenItems`. ## Verification In game, `horizon-ctl` on the inventory screen: | Bundle | Tooltip | | --- | --- | | 64 stone | one slot, 64, full red bar labelled "Full!" | | 32 stone + 8 dirt | two slots (32 stone first, as the next out; then 8 dirt), half-filled blue bar | | empty | "Can hold a mixed stack of items" and "Empty" | `bundle::tooltip_tests` pin the grid order (bottom-right first), the twelve-stack limit and the `+N` cell, the centred column, the empty bundle's description/bar geometry and the full/empty labels. ## Scope 5 files, +373 −16 (`bundle.rs`, `game/stations.rs`, `game.rs`, `game/beacon.rs`, `game/trading.rs`). 🤖 Generated with [[CC]](https://github.com/levzzz5154/horizon). ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos-x8664, upstream 7ecb43cc) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +373 −16 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ | | clippy | ❌ failed (same `axolotl.rs:169` error as `upstream/main`) | | tests: horizon-client | ✅ 1295 passed | | doc tests | ✅ | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt / clippy / tests | ➖ launcher untouched | | Parity | ➖ 272 affected, to run in CI (--quick) | | Label | no label for a fix | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:35 +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#3959
No description provided.