[PR #6180] [MERGED] Shield's blocking knockback comes before the hit's (partial blocks) #6701

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

📋 Pull Request Information

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

Base: main ← Head: fix/6109-shield-partial-knockback


📝 Commits (2)

  • 8195aa8 Shield: the item's blocking knockback comes before the hit's default knockback
  • 5fe8c6d Merge main into fix/6109-shield-partial-knockback

📊 Changes

1 file changed (+24 additions, -3 deletions)

View changed files

📝 tools/test_server_knockback_parity.py (+24 -3)

📄 Description

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

What

A shield that blocks only part of a melee hit (damage_reductions factor < 1) pushed its holder the wrong way: hurt_player_from made the hit's default 0.4 push before after_block (the shield's 0.5 push in blocked_by_attacker). after_block now runs right after hurt_caused_by fills the outcome, before the default knockback, and still runs when the hit does not hurt. Hurt log and thorns/advancement order are unchanged.

Vanilla reference

LivingEntity.hurtServer: applyItemBlocking (line ~1202, with blockedByItem's knockback) runs before dealDefaultKnockback (~1251). knockback halves the old motion, so order matters.

How tested

tools/test_server_knockback_parity.py: new cases pvp-shield-partial (player hit, damage_reductions factor 0.5) and zombie-shield-partial; both failed before the fix and match vanilla now (pvp-shield still passes). The cases wait 2 ticks before use, since a stack swapped in right after an earlier shield case made the server drop the use.

pr_ready --quick: scope 2 files +53 −25, Python tests 586 passed, rustfmt, clippy and public tree pass. horizon-client lib tests: 1196 passed, 1 failed: entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation ("an airborne stand must fall"), in entities.rs which this PR does not touch; it fails on its own here and looks environmental.
Harnesses run: server_knockback PASS, server_entities PASS.
Remaining affected harnesses: run by CI's parity job.

Fixes #6109

Suggested label: none

🤖 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/6180 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/6109-shield-partial-knockback` --- ### 📝 Commits (2) - [`8195aa8`](https://github.com/horizon-rust/horizon/commit/8195aa8b368c71b2a5e52205dc4102d70a7b5438) Shield: the item's blocking knockback comes before the hit's default knockback - [`5fe8c6d`](https://github.com/horizon-rust/horizon/commit/5fe8c6defaab371e760b99d5276b2e05f7bd5280) Merge main into fix/6109-shield-partial-knockback ### 📊 Changes **1 file changed** (+24 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tools/test_server_knockback_parity.py` (+24 -3) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally. ## What A shield that blocks only part of a melee hit (`damage_reductions` factor < 1) pushed its holder the wrong way: `hurt_player_from` made the hit's default 0.4 push before `after_block` (the shield's 0.5 push in `blocked_by_attacker`). `after_block` now runs right after `hurt_caused_by` fills the outcome, before the default knockback, and still runs when the hit does not hurt. Hurt log and thorns/advancement order are unchanged. ## Vanilla reference `LivingEntity.hurtServer`: `applyItemBlocking` (line ~1202, with `blockedByItem`'s knockback) runs before `dealDefaultKnockback` (~1251). `knockback` halves the old motion, so order matters. ## How tested `tools/test_server_knockback_parity.py`: new cases `pvp-shield-partial` (player hit, `damage_reductions` factor 0.5) and `zombie-shield-partial`; both failed before the fix and match vanilla now (`pvp-shield` still passes). The cases wait 2 ticks before `use`, since a stack swapped in right after an earlier shield case made the server drop the `use`. `pr_ready --quick`: scope 2 files +53 −25, Python tests 586 passed, rustfmt, clippy and public tree pass. horizon-client lib tests: 1196 passed, 1 failed: `entities::armor_stand_motion_tests::a_tick_keeps_the_previous_position_for_interpolation` ("an airborne stand must fall"), in `entities.rs` which this PR does not touch; it fails on its own here and looks environmental. Harnesses run: `server_knockback` PASS, `server_entities` PASS. Remaining affected harnesses: run by CI's parity job. Fixes #6109 Suggested label: none 🤖 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:25:06 +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#6701
No description provided.