[PR #5606] [MERGED] Shield: a hit fully blocked on Easy no longer pulls the player in #6383

Closed
opened 2026-11-03 06:19:45 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5606
Author: @rdbtCVS
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/2800-shield-full-block-easy


📝 Commits (1)

  • 94970ae Shield: a hit fully blocked on Easy no longer pulls the player in

📊 Changes

5 files changed (+63 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+1 -1)
📝 crates/horizon-client/src/game/explosion.rs (+1 -1)
📝 crates/horizon-client/src/game/shield.rs (+2 -3)
📝 crates/horizon-client/src/health.rs (+58 -0)
📝 crates/horizon-client/src/hunger.rs (+1 -0)

📄 Description

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

On Easy, a mob hit that the shield takes completely pulled the player toward the mob.

Vanilla 26.3 (bytecode via rea_vanilla.py):

  • Player.hurtServer scales the damage for the difficulty first (Easy: min(d/2 + 1, d)), then calls LivingEntity.hurtServer.
  • LivingEntity.applyItemBlocking calls blockUsingItem(level, attacker, source, damage, damageBlocked >= damage) with that scaled damage.
  • LivingEntity.blockedByItem runs defender.knockback(0.5, defender − attacker) only when !fullyBlocked. That knockback does pull the defender toward the attacker, so a partial block pulling you in is vanilla.

Horizon worked out fully in game/shield.rs by comparing the blocked amount, which is based on the scaled damage, with the raw damage. On Easy, a 4-damage zombie hit is scaled to 3 and the shield blocks all 3. 3 >= 4 is false, so the hit counted as partial and the player was pulled in.

Fix: apply_blocking in health.rs now records fully_blocked = blocked >= damage at the point where it has the scaled damage. BlockOutcome carries it, and the shield reads it. after_block no longer needs its raw damage argument.

Fixes #2800

Tests: new health::tests::a_shield_fully_blocks_a_hit_scaled_down_by_easy (Easy, 4 → 3, fully blocked, no knockback). cargo clippy -p horizon-client --all-targets -D warnings passes.

pr_ready (tools/pr_ready.py --quick on archlinux, against origin/main at c9d8e3efa, 13 min 45 s)

Check Result
Scope ✅ 6 files, +63 −5
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 510 passed (41 s)
rustfmt ✅ (10 s)
clippy ✅ (5 min 59 s)
tests: horizon-client ✅ 1577 passed (6 min 34 s)
doc tests ✅ 0 passed (19 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 365 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 353 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/5606 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/2800-shield-full-block-easy` --- ### 📝 Commits (1) - [`94970ae`](https://github.com/horizon-rust/horizon/commit/94970aee257e01bb79b9c3b50fb7508c4e6dfa39) Shield: a hit fully blocked on Easy no longer pulls the player in ### 📊 Changes **5 files changed** (+63 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+1 -1) 📝 `crates/horizon-client/src/game/explosion.rs` (+1 -1) 📝 `crates/horizon-client/src/game/shield.rs` (+2 -3) 📝 `crates/horizon-client/src/health.rs` (+58 -0) 📝 `crates/horizon-client/src/hunger.rs` (+1 -0) </details> ### 📄 Description > 🤖 Opened by rdbtCVS's AI agent (Claude Code, Claude Opus 5.5), not by rdbtCVS personally. On Easy, a mob hit that the shield takes completely pulled the player toward the mob. **Vanilla 26.3** (bytecode via `rea_vanilla.py`): - `Player.hurtServer` scales the damage for the difficulty first (Easy: `min(d/2 + 1, d)`), then calls `LivingEntity.hurtServer`. - `LivingEntity.applyItemBlocking` calls `blockUsingItem(level, attacker, source, damage, damageBlocked >= damage)` with that scaled damage. - `LivingEntity.blockedByItem` runs `defender.knockback(0.5, defender − attacker)` only when `!fullyBlocked`. That knockback does pull the defender toward the attacker, so a partial block pulling you in is vanilla. **Horizon** worked out `fully` in `game/shield.rs` by comparing the blocked amount, which is based on the scaled damage, with the raw damage. On Easy, a 4-damage zombie hit is scaled to 3 and the shield blocks all 3. `3 >= 4` is false, so the hit counted as partial and the player was pulled in. **Fix:** `apply_blocking` in `health.rs` now records `fully_blocked = blocked >= damage` at the point where it has the scaled damage. `BlockOutcome` carries it, and the shield reads it. `after_block` no longer needs its raw `damage` argument. Fixes #2800 **Tests:** new `health::tests::a_shield_fully_blocks_a_hit_scaled_down_by_easy` (Easy, 4 → 3, fully blocked, no knockback). `cargo clippy -p horizon-client --all-targets -D warnings` passes. **pr_ready** (`tools/pr_ready.py --quick` on archlinux, against origin/main at c9d8e3efa, 13 min 45 s) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +63 −5 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 510 passed (41 s) | | rustfmt | ✅ (10 s) | | clippy | ✅ (5 min 59 s) | | tests: horizon-client | ✅ 1577 passed (6 min 34 s) | | doc tests | ✅ 0 passed (19 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 365 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 353 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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-03 06:19:45 +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#6383
No description provided.