[PR #7539] Respect player armor durability components #7656

Open
opened 2026-11-03 07:21:31 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7539
Author: @TheMrZZ
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/7480-player-armor-components


📝 Commits (1)

  • 63532f1 Respect player armor durability components

📊 Changes

2 files changed (+109 additions, -19 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+27 -18)
📝 tools/lan_e2e.py (+82 -1)

📄 Description

🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally.

What and why

Fixes #7480.

Player armor wear used registered item durability and could damage unbreakable stacks. Check the stack's damageability before enchantment RNG and wear hooks, use its component override for maximum damage, and break pieces at that effective limit. Keep the existing equipment-break callbacks and attribute refresh.

Extend the existing LAN damage session with normal, unbreakable, and custom-limit diamond armor on a fully ticking guest. The fixture acknowledges regeneration changes, waits against authoritative server game time, and reads server health and equipment.

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

Java 26.3 Player.hurtArmor / LivingEntity.doHurtEquipment, ItemStack.isDamageableItem, getMaxDamage, and hurtAndBreak: damageability requires the damage/max-damage components and excludes unbreakable stacks. Component removal is respected before wear processing.

Reference bytecode inspected from the pinned game jars. Regression: tools/lan_e2e.py --check damage, with normal wear, unbreakable wear, custom-limit breakage, and server-side equipment/health observations.

Other projects' code

None.

Self-check

pr_ready (tools/pr_ready.py --quick locally, against origin/main at 02c8607ee, 8 min 56 s)

Check Result
Scope ✅ 2 files, +109 −19
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (1 min 24 s)
rustfmt ✅ (17 s)
clippy ✅ (4 min 3 s)
tests: horizon-client ✅ 695 passed (3 min 8 s)
doc tests ✅ 0 passed (4 s)
content root tests ➖ content root untouched
mod API up to date ➖ native hooks 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)

port_ledger.py check --base origin/main completed with no new gaps or stale citations; one component-access callee gap closed. Existing mob-equipment and damage-source diagnostics remain outside this change.

The actual connected-player LAN fixture fails on unchanged 02c8607ee for unbreakable wear and custom-limit breakage, and passes those component checks with the fix. The normal control takes one durability damage in each slot. The fixed unbreakable pieces retain no damage component; all four custom max_damage=10,damage=9 pieces break after a 4-point cactus hit. The existing fall/water/damage checks also passed. The command-execution oracle was not used for player-health validation.

Separate follow-up

The fixture records the independent same-hit reduction-order discrepancy without making it a component-test gate: after the custom armor breaks, Horizon still ends at 999.04 health rather than Java's 996. The health adapter defers armor wear until after damage calculation. This PR fixes component-aware wear; that ordering path and helmet-fall behavior are outside this change.

The full affected parity suite has not been run locally (pr_ready --quick).

🤖 Generated with 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/7539 **Author:** [@TheMrZZ](https://github.com/TheMrZZ) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/7480-player-armor-components` --- ### 📝 Commits (1) - [`63532f1`](https://github.com/horizon-rust/horizon/commit/63532f16e065b99c4c5b5df4cf6bc182639daa08) Respect player armor durability components ### 📊 Changes **2 files changed** (+109 additions, -19 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+27 -18) 📝 `tools/lan_e2e.py` (+82 -1) </details> ### 📄 Description > 🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally. ## What and why Fixes #7480. Player armor wear used registered item durability and could damage unbreakable stacks. Check the stack's damageability before enchantment RNG and wear hooks, use its component override for maximum damage, and break pieces at that effective limit. Keep the existing equipment-break callbacks and attribute refresh. Extend the existing LAN damage session with normal, unbreakable, and custom-limit diamond armor on a fully ticking guest. The fixture acknowledges regeneration changes, waits against authoritative server game time, and reads server health and equipment. ## 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 Java 26.3 `Player.hurtArmor` / `LivingEntity.doHurtEquipment`, `ItemStack.isDamageableItem`, `getMaxDamage`, and `hurtAndBreak`: damageability requires the damage/max-damage components and excludes unbreakable stacks. Component removal is respected before wear processing. Reference bytecode inspected from the pinned game jars. Regression: `tools/lan_e2e.py --check damage`, with normal wear, unbreakable wear, custom-limit breakage, and server-side equipment/health observations. ## Other projects' code None. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` locally, against origin/main at 02c8607ee, 8 min 56 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +109 −19 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (1 min 24 s) | | rustfmt | ✅ (17 s) | | clippy | ✅ (4 min 3 s) | | tests: horizon-client | ✅ 695 passed (3 min 8 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks 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) | `port_ledger.py check --base origin/main` completed with no new gaps or stale citations; one component-access callee gap closed. Existing mob-equipment and damage-source diagnostics remain outside this change. The actual connected-player LAN fixture fails on unchanged `02c8607ee` for unbreakable wear and custom-limit breakage, and passes those component checks with the fix. The normal control takes one durability damage in each slot. The fixed unbreakable pieces retain no damage component; all four custom `max_damage=10,damage=9` pieces break after a 4-point cactus hit. The existing fall/water/damage checks also passed. The command-execution oracle was not used for player-health validation. ## Separate follow-up The fixture records the independent same-hit reduction-order discrepancy without making it a component-test gate: after the custom armor breaks, Horizon still ends at 999.04 health rather than Java's 996. The health adapter defers armor wear until after damage calculation. This PR fixes component-aware wear; that ordering path and helmet-fall behavior are outside this change. The full affected parity suite has not been run locally (`pr_ready --quick`). 🤖 Generated with [Codex](https://openai.com/codex/) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7656
No description provided.