[PR #1547] [MERGED] No default knockback from a hit inside the hurt cooldown #3576

Closed
opened 2026-11-03 04:10:33 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/kb1-cooldown-knockback


📝 Commits (1)

  • 01133fa No default knockback from a hit inside the hurt cooldown

📊 Changes

3 files changed (+52 additions, -7 deletions)

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+10 -6)
📝 crates/horizon-client/src/health.rs (+41 -1)
📝 crates/horizon-client/src/hunger.rs (+1 -0)

📄 Description

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

What

mob_hits_player applies the default knockback (0.4 away from the attacker) only when the hurt's knockback hook ran (BlockOutcome::knockback), instead of whenever the hurt was accepted.

Why

LivingEntity.hurtServer calls dealDefaultKnockback only on a fresh hit that isn't fully blocked. A harder hit inside the hurt cooldown only hurts by the difference: it marks nothing and pushes nothing. Horizon pushed the player 0.4 for it anyway, so a weak swing followed quickly by a charged one knocked the player back twice.

  • This applies to the in-frame host and, on main, to guests: their client got a second motion packet.
  • vanilla's server sends one packet. Main sends two: 0.83, then 0.82 (harness case pvp-cooldown in #1545).

How tested

$ cargo fmt --all -- --check                                   # clean
$ cargo clippy --workspace --all-targets -- -D warnings        # clean (on each branch alone and on the integration commit of all six)
$ cargo test -p horizon-client                                 # 1205 passed, 0 failed (integration commit)
  (new: health::tests::a_hit_in_the_hurt_cooldown_knocks_nobody_back: a fresh hit knocks back,
   a stronger one in the cooldown hurts with no knockback, a weaker one doesn't hurt)
$ python3 tools/parity.py --changed origin/main                # 107 passed, 0 failed (integration commit of all six)

This PR doesn't depend on the others. For guests, #1548 alone already stops the extra packet: a cooldown hit marks nothing. That is why the harness case passes with or without this one, and the unit test holds this fix.

🤖 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/1547 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/kb1-cooldown-knockback` --- ### 📝 Commits (1) - [`01133fa`](https://github.com/horizon-rust/horizon/commit/01133fac82e335c65dd2aafe83b9efc19055e2e0) No default knockback from a hit inside the hurt cooldown ### 📊 Changes **3 files changed** (+52 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+10 -6) 📝 `crates/horizon-client/src/health.rs` (+41 -1) 📝 `crates/horizon-client/src/hunger.rs` (+1 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What `mob_hits_player` applies the default knockback (0.4 away from the attacker) only when the hurt's knockback hook ran (`BlockOutcome::knockback`), instead of whenever the hurt was accepted. ## Why `LivingEntity.hurtServer` calls `dealDefaultKnockback` only on a fresh hit that isn't fully blocked. A harder hit inside the hurt cooldown only hurts by the difference: it marks nothing and pushes nothing. Horizon pushed the player 0.4 for it anyway, so a weak swing followed quickly by a charged one knocked the player back twice. - This applies to the in-frame host and, on main, to guests: their client got a second motion packet. - vanilla's server sends one packet. Main sends two: 0.83, then 0.82 (harness case pvp-cooldown in #1545). ## How tested ``` $ cargo fmt --all -- --check # clean $ cargo clippy --workspace --all-targets -- -D warnings # clean (on each branch alone and on the integration commit of all six) $ cargo test -p horizon-client # 1205 passed, 0 failed (integration commit) (new: health::tests::a_hit_in_the_hurt_cooldown_knocks_nobody_back: a fresh hit knocks back, a stronger one in the cooldown hurts with no knockback, a weaker one doesn't hurt) $ python3 tools/parity.py --changed origin/main # 107 passed, 0 failed (integration commit of all six) ``` This PR doesn't depend on the others. For guests, #1548 alone already stops the extra packet: a cooldown hit marks nothing. That is why the harness case passes with or without this one, and the unit test holds this fix. 🤖 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 04:10:33 +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#3576
No description provided.