[GH-ISSUE #5721] Durability bar is drawn on unbreakable items #1787

Closed
opened 2026-11-02 15:49:39 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @itsmyfox on GitHub (Nov 1, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5721

Originally assigned to: @navinor on GitHub.

Version: Nightly 2026-10-31 (68ac6f6).

What happens
/give @s diamond_hoe[damage=58,unbreakable={}]: vanilla 26.3 shows no durability bar; Horizon shows a green bar. Every unbreakable damaged item shows it too (our vehicle items use damage values with unbreakable).

Cause
Vanilla ItemStack.isBarVisible uses isDamaged(), which needs isDamageableItem() (max_damage present and no unbreakable). Horizon's damage_bar in crates/horizon-client-render/src/hud_overlays.rs only looks at damage and max_damage. The item model's damaged property already handles unbreakable correctly.

Suggested fix
Return no bar when the stack has the minecraft:unbreakable component.

Image
Originally created by @itsmyfox on GitHub (Nov 1, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5721 Originally assigned to: @navinor on GitHub. **Version:** Nightly 2026-10-31 (68ac6f6). **What happens** `/give @s diamond_hoe[damage=58,unbreakable={}]`: vanilla 26.3 shows no durability bar; Horizon shows a green bar. Every unbreakable damaged item shows it too (our vehicle items use damage values with `unbreakable`). **Cause** Vanilla `ItemStack.isBarVisible` uses `isDamaged()`, which needs `isDamageableItem()` (`max_damage` present and no `unbreakable`). Horizon's `damage_bar` in `crates/horizon-client-render/src/hud_overlays.rs` only looks at `damage` and `max_damage`. The item model's `damaged` property already handles `unbreakable` correctly. **Suggested fix** Return no bar when the stack has the `minecraft:unbreakable` component. <img width="1120" height="160" alt="Image" src="https://github.com/user-attachments/assets/aeaf11f1-5e84-42ba-b1b2-057e78c8225d" />
Author
Owner

@navinor commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6553504925 --> @navinor commented on GitHub (Nov 1, 2026): /claim
Author
Owner

@kira-horizon[bot] commented on GitHub (Nov 1, 2026):

Claimed by Navinor on Discord (GitHub: navinor), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #5721).

<!-- gh-comment-id:6553509559 --> @kira-horizon[bot] commented on GitHub (Nov 1, 2026): Claimed by `Navinor` on Discord (GitHub: `navinor`), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #5721). <!-- kira:work -->
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#1787
No description provided.