[PR #3504] [MERGED] Potion tooltips show effect durations as 03:00, not 3:00, like vanilla #5031

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

📋 Pull Request Information

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

Base: main ← Head: fix/3425-potion-duration-padding


📝 Commits (2)

📊 Changes

2 files changed (+17 additions, -14 deletions)

View changed files

📝 crates/horizon-client-render/src/brewing.rs (+16 -7)
📝 crates/horizon-client-render/src/inventory_effects.rs (+1 -7)

📄 Description

🤖 Opened by asowneryt's AI agent (Claude), not by asowneryt himself.

What and why

Potion, splash/lingering potion and tipped arrow tooltips printed effect durations without padding the minutes: Speed (3:00), Weakness (0:07). Vanilla prints Speed (03:00), Weakness (00:07), and 01:00:00 from an hour up. The cause: brewing::format_duration padded only the seconds ({m}:{s:02}, {h}:{m:02}:{s:02}).

brewing.rs now has one port of StringUtil.formatTickDuration (format_tick_duration(ticks, tick_rate): Mth.floor(ticks / tickrate), then %02d on every field). format_duration calls it at 20 TPS, and the inventory's effect panel (inventory_effects.rs) now uses it instead of its own copy, so the panel and the tooltip on the same screen agree.

Left alone on purpose: tooltips still format at a fixed 20 TPS. Passing the level's tick rate means changing brewing::tooltip's signature, which #3405 is rewriting right now; that fits better as a small follow-up once #3405 lands. It only matters under /tick rate.

Fixes #3425.

Vanilla reference

PotionContents.addPotionTooltip → MobEffectUtil.formatDuration → StringUtil.formatTickDuration (26.3, client and server sources). Checked by the brewing unit test, extended with the issue's cases (140 → 00:07, 1800 → 01:30, 9600 → 08:00, 72000 → 01:00:00, and a 40 TPS case); no parity harness covers tooltip text.

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on cachyos, against upstream/main at c9d61dcab, 29 min 59 s)

Check Result
Scope ✅ 2 files, +17 −14
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 408 passed (20 s)
rustfmt ✅ (4 s)
clippy ✅ (1 min 19 s)
tests: horizon-client ✅ 1291 passed (2 min 12 s)
doc tests ✅ 0 passed (20 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 ✅ 70 affected, 69 passed (25 min 34 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Suggested label: none (a fix)

🤖 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/3504 **Author:** [@ASOwnerYT](https://github.com/ASOwnerYT) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/3425-potion-duration-padding` --- ### 📝 Commits (2) - [`8503210`](https://github.com/horizon-rust/horizon/commit/85032102a86e08de027b3ac10b7967ac5d64fbf6) Potion tooltips zero-pad effect durations as vanilla does - [`d5a7e84`](https://github.com/horizon-rust/horizon/commit/d5a7e8420b6660b26197bf1f3d7aff758ebe51f7) Merge branch 'main' of https://github.com/horizon-rust/horizon into fix/3425-potion-duration-padding ### 📊 Changes **2 files changed** (+17 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/brewing.rs` (+16 -7) 📝 `crates/horizon-client-render/src/inventory_effects.rs` (+1 -7) </details> ### 📄 Description > 🤖 Opened by asowneryt's AI agent (Claude), not by asowneryt himself. ## What and why Potion, splash/lingering potion and tipped arrow tooltips printed effect durations without padding the minutes: `Speed (3:00)`, `Weakness (0:07)`. Vanilla prints `Speed (03:00)`, `Weakness (00:07)`, and `01:00:00` from an hour up. The cause: `brewing::format_duration` padded only the seconds (`{m}:{s:02}`, `{h}:{m:02}:{s:02}`). `brewing.rs` now has one port of `StringUtil.formatTickDuration` (`format_tick_duration(ticks, tick_rate)`: `Mth.floor(ticks / tickrate)`, then `%02d` on every field). `format_duration` calls it at 20 TPS, and the inventory's effect panel (`inventory_effects.rs`) now uses it instead of its own copy, so the panel and the tooltip on the same screen agree. Left alone on purpose: tooltips still format at a fixed 20 TPS. Passing the level's tick rate means changing `brewing::tooltip`'s signature, which #3405 is rewriting right now; that fits better as a small follow-up once #3405 lands. It only matters under `/tick rate`. Fixes #3425. ## Vanilla reference `PotionContents.addPotionTooltip` → `MobEffectUtil.formatDuration` → `StringUtil.formatTickDuration` (26.3, client and server sources). Checked by the `brewing` unit test, extended with the issue's cases (140 → `00:07`, 1800 → `01:30`, 9600 → `08:00`, 72000 → `01:00:00`, and a 40 TPS case); no parity harness covers tooltip text. ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on cachyos, against upstream/main at c9d61dcab, 29 min 59 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +17 −14 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 408 passed (20 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (1 min 19 s) | | tests: horizon-client | ✅ 1291 passed (2 min 12 s) | | doc tests | ✅ 0 passed (20 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 | ✅ 70 affected, 69 passed (25 min 34 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Suggested label: none (a fix) 🤖 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 05:09:44 +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#5031
No description provided.