[PR #1101] [MERGED] Explosions: two Blast Protection pieces cancel the knockback (explosion_knockback_resistance, per-slot enchantment modifiers) #3048

Closed
opened 2026-11-02 16:01:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/explosion-knockback-resistance


📝 Commits (1)

  • 9d96bb6 Explosions: knockback reads explosion_knockback_resistance; armor enchantment modifiers stack per slot

📊 Changes

3 files changed (+26 additions, -10 deletions)

View changed files

📝 crates/horizon-client/src/enchant.rs (+1 -1)
📝 crates/horizon-client/src/game/enchant_effects.rs (+7 -2)
📝 crates/horizon-client/src/game/explosion.rs (+18 -7)

📄 Description

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

Fixes #1049. Reported by Visivel on Discord: thanks!

What

Two Blast Protection IV pieces now cancel explosion knockback, as in vanilla (0.15 explosion knockback resistance per level and piece: 1.2, capped at 1).

Why

  • ServerExplosion.hurtEntities scales a living entity's knockback by Attributes.EXPLOSION_KNOCKBACK_RESISTANCE. Horizon ignored it for the player, and used KNOCKBACK_RESISTANCE for mobs (so explosions never pushed iron golems or ravagers; every type's explosion resistance base is 0 in vanilla's attribute defaults).
  • EnchantmentAttributeEffect.idForSlot: an enchantment's attribute modifier id ends with the slot (minecraft:enchantment.blast_protection/chest). Horizon used <id>.<level>, so the same enchantment at the same level on two pieces had one id and the second piece replaced the first: two Blast Protection IV pieces gave 0.6, not 1.2. This also fixes stacking for Fire Protection's burning_time and the other armor attribute enchantments.
  • hitPlayers skips creative players who are flying: they get no knockback.

How

game/explosion.rs (player and mob knockback), enchant.rs and game/enchant_effects.rs (per-slot ids).

Proof

Self-check on one integration commit holding the seven B4 branches (#1049 #1050 #1046 #1056 #505 #504 #1097), on origin/main caeffffb, on the Mac mini:

cargo fmt --all --check                                                   ok
set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings    exit 0
cargo test -p horizon-client -p horizon-world                             all passed, 0 failed (horizon-client lib 959, horizon-world lib 152, ...)

tools/parity.py --changed origin/main (selects 304 of 326 harnesses: the branches touch game.rs): running on the integration commit; the result follows in a comment.

Needs Ludovic

Nothing.

🤖 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/1101 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/21/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/explosion-knockback-resistance` --- ### 📝 Commits (1) - [`9d96bb6`](https://github.com/horizon-rust/horizon/commit/9d96bb6ec7352a885889b88e7a4922092d5e9b69) Explosions: knockback reads explosion_knockback_resistance; armor enchantment modifiers stack per slot ### 📊 Changes **3 files changed** (+26 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/enchant.rs` (+1 -1) 📝 `crates/horizon-client/src/game/enchant_effects.rs` (+7 -2) 📝 `crates/horizon-client/src/game/explosion.rs` (+18 -7) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #1049. Reported by **Visivel** on Discord: thanks! ## What Two Blast Protection IV pieces now cancel explosion knockback, as in vanilla (0.15 explosion knockback resistance per level and piece: 1.2, capped at 1). ## Why - `ServerExplosion.hurtEntities` scales a living entity's knockback by `Attributes.EXPLOSION_KNOCKBACK_RESISTANCE`. Horizon ignored it for the player, and used `KNOCKBACK_RESISTANCE` for mobs (so explosions never pushed iron golems or ravagers; every type's explosion resistance base is 0 in vanilla's attribute defaults). - `EnchantmentAttributeEffect.idForSlot`: an enchantment's attribute modifier id ends with the slot (`minecraft:enchantment.blast_protection/chest`). Horizon used `<id>.<level>`, so the same enchantment at the same level on two pieces had one id and the second piece replaced the first: two Blast Protection IV pieces gave 0.6, not 1.2. This also fixes stacking for Fire Protection's `burning_time` and the other armor attribute enchantments. - `hitPlayers` skips creative players who are flying: they get no knockback. ## How `game/explosion.rs` (player and mob knockback), `enchant.rs` and `game/enchant_effects.rs` (per-slot ids). ## Proof Self-check on one integration commit holding the seven B4 branches (#1049 #1050 #1046 #1056 #505 #504 #1097), on origin/main `caeffffb`, on the Mac mini: ``` cargo fmt --all --check ok set -o pipefail; cargo clippy --workspace --all-targets -- -D warnings exit 0 cargo test -p horizon-client -p horizon-world all passed, 0 failed (horizon-client lib 959, horizon-world lib 152, ...) ``` `tools/parity.py --changed origin/main` (selects 304 of 326 harnesses: the branches touch `game.rs`): running on the integration commit; the result follows in a comment. ## Needs Ludovic Nothing. 🤖 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-02 16:01:04 +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#3048
No description provided.