[PR #7775] A mob's gear counts in its knockback resistance #7814

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

📋 Pull Request Information

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

Base: main ← Head: fix/mob-knockback-equipment


📝 Commits (1)

  • 9b6684d A mob's gear counts in its knockback resistance

📊 Changes

5 files changed (+67 additions, -9 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+2 -1)
📝 crates/horizon-client/src/game/lan_attributes.rs (+27 -0)
📝 crates/horizon-client/src/game/mace.rs (+2 -7)
📝 crates/horizon-client/src/health.rs (+25 -0)
📝 crates/horizon-client/src/mobs.rs (+11 -1)

📄 Description

🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally.

Fixes #7755

LivingEntity.knockback scales a push by 1 - getAttributeValue(KNOCKBACK_RESISTANCE), which includes the modifiers of worn and held items (netherite: 0.1 a piece). Mob::knockback used the mob's own attrs.knockback_resistance, so a zombie in full netherite flew as far as an unarmoured one. Punch (creatures.rs) and the mace smash (mace.rs) read the same bare field.

The mob can't see items, but Game::mob_knockback_resistance already works the full value out (the sonic boom uses it). refresh_gear_knockback_resistance (start of tick_creatures) stores it in a new Mob::gear_knockback_resistance for each mob that wears or holds something, None for the rest. Mob::knockback_resistance() returns it, else the own value, and knockback_by, Punch and the mace read that.

Test: a_mobs_gear_resists_knockback (gear 0.4 gives 60 % of the push, and replaces the mob's own value). cargo test -p horizon-client-lib --lib knockback, clippy. I did not run the zombie-in-netherite check from the issue in game.

🤖 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/7775 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/mob-knockback-equipment` --- ### 📝 Commits (1) - [`9b6684d`](https://github.com/horizon-rust/horizon/commit/9b6684d8c40b9d9e59f848974c4b3fd145ad5bf5) A mob's gear counts in its knockback resistance ### 📊 Changes **5 files changed** (+67 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+2 -1) 📝 `crates/horizon-client/src/game/lan_attributes.rs` (+27 -0) 📝 `crates/horizon-client/src/game/mace.rs` (+2 -7) 📝 `crates/horizon-client/src/health.rs` (+25 -0) 📝 `crates/horizon-client/src/mobs.rs` (+11 -1) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally. Fixes #7755 `LivingEntity.knockback` scales a push by `1 - getAttributeValue(KNOCKBACK_RESISTANCE)`, which includes the modifiers of worn and held items (netherite: 0.1 a piece). `Mob::knockback` used the mob's own `attrs.knockback_resistance`, so a zombie in full netherite flew as far as an unarmoured one. Punch (`creatures.rs`) and the mace smash (`mace.rs`) read the same bare field. The mob can't see items, but `Game::mob_knockback_resistance` already works the full value out (the sonic boom uses it). `refresh_gear_knockback_resistance` (start of `tick_creatures`) stores it in a new `Mob::gear_knockback_resistance` for each mob that wears or holds something, `None` for the rest. `Mob::knockback_resistance()` returns it, else the own value, and `knockback_by`, Punch and the mace read that. Test: `a_mobs_gear_resists_knockback` (gear 0.4 gives 60 % of the push, and replaces the mob's own value). `cargo test -p horizon-client-lib --lib knockback`, clippy. I did not run the zombie-in-netherite check from the issue in game. 🤖 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>
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#7814
No description provided.