[PR #7512] Use effective mob armor and toughness for damage reduction #7636

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

📋 Pull Request Information

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

Base: main ← Head: fix/mob-effective-armor


📝 Commits (2)

  • bda8998 Use effective mob armor and toughness for runtime damage
  • ec79278 Merge main into mob effective armor fix

📊 Changes

7 files changed (+210 additions, -23 deletions)

View changed files

📝 crates/horizon-client/src/game/commands/data.rs (+1 -0)
📝 crates/horizon-client/src/game/commands/world_cmds.rs (+14 -1)
📝 crates/horizon-client/src/game/lan_attributes.rs (+15 -6)
📝 crates/horizon-client/src/mobs.rs (+14 -16)
➕ crates/horizon-client/src/mobs/armor.rs (+140 -0)
📝 crates/horizon-world/src/attributes/entity.rs (+1 -0)
📝 tools/command_exec_corpus.py (+25 -0)

📄 Description

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

What and why

Changing a mob's armor and toughness now affects damage. A pig with health 1000, armor 20, and toughness 8 retains scaled health 999039 after four cactus damage, matching Java 26.3; previously it retained 996000 because damage read the species defaults.

Armor and toughness commands use a mob-owned map of the existing attribute instances. Damage reads those instances and combines worn-equipment and covered-shell bonuses once, before multiplicative modifiers and effective clamping. Armor is floored before conversion to float, while toughness converts its effective double directly. Armor-bypassing damage skips these reads.

The owned map follows runtime /data rewrites and remains available to the existing attribute snapshot path. EntityAttributes gains Clone/Debug so mob snapshots can carry it. This does not change the attribute saved format, player armor wear, or helmet damage behavior.

Fixes #7494.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

Official Java 26.3 LivingEntity.getArmorValue floors getAttributeValue(ARMOR). getDamageAfterArmorAbsorb skips armor-bypassing sources; otherwise its attribute inputs to CombatRules are that integer converted to float and effective toughness converted to float. The attribute bounds are armor [0,30] and toughness [0,20], applied to effective values rather than raw bases. The existing wear lifecycle is outside this change.

Other projects' code

None.

Self-check

Two focused resource-independent tests pass: the measured pig-health result, zero/fractional armor and bypass controls, equipment and covered-shell bonuses, and effective limits. The command-execution corpus adds 28 cases and 140 recorded operations across armor 0/0.5/1/20, toughness 0/8, cactus amounts 0.25/4/100, and arrow/generic/falling-anvil/sonic-boom controls. Each case checks setup getters and health before final health.

After merging current main, the focused native Game command corpus matches fresh official Java 26.3 on 140/140 observations across all 28 cases. This covers attribute getters, setup health and final health, including the canonical 999039 pig result.

pr_ready (tools/pr_ready.py --quick on a local runner, against origin/main at 712474960, 8 min 33 s)

Check Result
Scope ✅ 7 files, +210 −23
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (36 s)
rustfmt ✅ (6 s)
clippy ✅
tests: horizon-client, horizon-client-lib, horizon-world ❌ 2509 passed, 6 failed (7 min 36 s)
doc tests ✅ 0 passed (4 s)
content root tests ➖ content root untouched
mod API up to date ✅ (11 s)
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)

The six failed horizon-world piston tests also fail on unchanged main 712474960 in the same environment (five under the piston filter and refused_sticky_pull_keeps_the_block_and_sends_no_event separately). The world-crate diff here only derives Clone/Debug for EntityAttributes; these failures are retained in the report rather than reported as passing.

🤖 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/7512 **Author:** [@TheMrZZ](https://github.com/TheMrZZ) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/mob-effective-armor` --- ### 📝 Commits (2) - [`bda8998`](https://github.com/horizon-rust/horizon/commit/bda89987c7cfb561d78a2a8fee8f0699cdbf2295) Use effective mob armor and toughness for runtime damage - [`ec79278`](https://github.com/horizon-rust/horizon/commit/ec792786a02b4ac8943a91cb5f1148495eeeebdc) Merge main into mob effective armor fix ### 📊 Changes **7 files changed** (+210 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/commands/data.rs` (+1 -0) 📝 `crates/horizon-client/src/game/commands/world_cmds.rs` (+14 -1) 📝 `crates/horizon-client/src/game/lan_attributes.rs` (+15 -6) 📝 `crates/horizon-client/src/mobs.rs` (+14 -16) ➕ `crates/horizon-client/src/mobs/armor.rs` (+140 -0) 📝 `crates/horizon-world/src/attributes/entity.rs` (+1 -0) 📝 `tools/command_exec_corpus.py` (+25 -0) </details> ### 📄 Description > 🤖 Opened by TheMrZZ's AI agent (Codex, gpt-6.1-sol), not by TheMrZZ personally. ## What and why Changing a mob's armor and toughness now affects damage. A pig with health 1000, armor 20, and toughness 8 retains scaled health `999039` after four cactus damage, matching Java 26.3; previously it retained `996000` because damage read the species defaults. Armor and toughness commands use a mob-owned map of the existing attribute instances. Damage reads those instances and combines worn-equipment and covered-shell bonuses once, before multiplicative modifiers and effective clamping. Armor is floored before conversion to float, while toughness converts its effective double directly. Armor-bypassing damage skips these reads. The owned map follows runtime `/data` rewrites and remains available to the existing attribute snapshot path. EntityAttributes gains Clone/Debug so mob snapshots can carry it. This does not change the attribute saved format, player armor wear, or helmet damage behavior. Fixes #7494. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference Official Java 26.3 `LivingEntity.getArmorValue` floors `getAttributeValue(ARMOR)`. `getDamageAfterArmorAbsorb` skips armor-bypassing sources; otherwise its attribute inputs to CombatRules are that integer converted to float and effective toughness converted to float. The attribute bounds are armor `[0,30]` and toughness `[0,20]`, applied to effective values rather than raw bases. The existing wear lifecycle is outside this change. ## Other projects' code None. ## Self-check Two focused resource-independent tests pass: the measured pig-health result, zero/fractional armor and bypass controls, equipment and covered-shell bonuses, and effective limits. The command-execution corpus adds 28 cases and 140 recorded operations across armor 0/0.5/1/20, toughness 0/8, cactus amounts 0.25/4/100, and arrow/generic/falling-anvil/sonic-boom controls. Each case checks setup getters and health before final health. After merging current main, the focused native Game command corpus matches fresh official Java 26.3 on **140/140 observations across all 28 cases**. This covers attribute getters, setup health and final health, including the canonical `999039` pig result. **pr_ready** (`tools/pr_ready.py --quick` on a local runner, against origin/main at 712474960, 8 min 33 s) | Check | Result | | --- | --- | | Scope | ✅ 7 files, +210 −23 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (36 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ | | tests: horizon-client, horizon-client-lib, horizon-world | ❌ 2509 passed, 6 failed (7 min 36 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (11 s) | | 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) | The six failed `horizon-world` piston tests also fail on unchanged main `712474960` in the same environment (five under the `piston` filter and `refused_sticky_pull_keeps_the_block_and_sends_no_event` separately). The world-crate diff here only derives `Clone`/`Debug` for `EntityAttributes`; these failures are retained in the report rather than reported as passing. 🤖 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#7636
No description provided.