[PR #5256] [MERGED] fix(combat): a spear stab deals no default knockback #6168

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

📋 Pull Request Information

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

Base: main ← Head: fix/spear-no-knockback


📝 Commits (2)

  • 8955110 fix(combat): a spear stab deals no default knockback
  • 1b9ed48 Merge main into #5256 (main builds again after #5251)

📊 Changes

1 file changed (+27 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/mobs.rs (+27 -0)

📄 Description

What and why

spear is in #minecraft:no_knockback, so the hurt of a spear stab deals no default knockback
The stab pushes the target with causeExtraKnockback instead, which Horizon already does
Horizon's Damage::no_knockback missed spear, so a mob stabbed by a player or by a mob with a spear also got the default 0.4 push away from the attacker
It now gets only the stab's own push
A unit test stabs a mob and checks it is hurt and not pushed, and that a plain player hit still pushes it
A stabbed player was already right, as the player's hurt reads the tag from the data
Left as is: a sulfur cube with a block is still pushed by a stab, since its immune branch does not check no_knockback yet
#5155 adds that check, and spear then follows it

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

LivingEntity.hurtServer calls dealDefaultKnockback only for a type outside #minecraft:no_knockback (world/entity/LivingEntity.java:1258-1259)
Player.stabAttack hurts with the spear's damage source and then calls causeExtraKnockback twice (world/entity/player/Player.java:1195-1222)
LivingEntity.stabAttack does the same for a mob (world/entity/LivingEntity.java:2898-2920)
A spear's damage_type component is spear (world/item/Item.java:532)
Data tags/damage_type/no_knockback.json ends with minecraft:spear

Other projects' code

none

Self-check

Check Result
Scope ✅ 1 files, +27 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (56 s)
rustfmt ✅ (8 s)
clippy ✅ (1 min 53 s)
tests: horizon-client ✅ 1343 passed (5 min 12 s)
doc tests ✅ 0 passed (2 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 ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🔄 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/5256 **Author:** [@reservedbytes](https://github.com/reservedbytes) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/spear-no-knockback` --- ### 📝 Commits (2) - [`8955110`](https://github.com/horizon-rust/horizon/commit/89551109f970ff5aa71296433a7061497882623c) fix(combat): a spear stab deals no default knockback - [`1b9ed48`](https://github.com/horizon-rust/horizon/commit/1b9ed487aedb441c78ddec43918f55c9ccdbaae4) Merge main into #5256 (main builds again after #5251) ### 📊 Changes **1 file changed** (+27 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs.rs` (+27 -0) </details> ### 📄 Description ## What and why `spear` is in `#minecraft:no_knockback`, so the hurt of a spear stab deals no default knockback The stab pushes the target with `causeExtraKnockback` instead, which Horizon already does Horizon's `Damage::no_knockback` missed `spear`, so a mob stabbed by a player or by a mob with a spear also got the default 0.4 push away from the attacker It now gets only the stab's own push A unit test stabs a mob and checks it is hurt and not pushed, and that a plain player hit still pushes it A stabbed player was already right, as the player's hurt reads the tag from the data Left as is: a sulfur cube with a block is still pushed by a stab, since its immune branch does not check `no_knockback` yet #5155 adds that check, and `spear` then follows it ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `LivingEntity.hurtServer` calls `dealDefaultKnockback` only for a type outside `#minecraft:no_knockback` (`world/entity/LivingEntity.java:1258-1259`) `Player.stabAttack` hurts with the spear's damage source and then calls `causeExtraKnockback` twice (`world/entity/player/Player.java:1195-1222`) `LivingEntity.stabAttack` does the same for a mob (`world/entity/LivingEntity.java:2898-2920`) A spear's `damage_type` component is `spear` (`world/item/Item.java:532`) Data `tags/damage_type/no_knockback.json` ends with `minecraft:spear` ## Other projects' code none ## Self-check | Check | Result | | --- | --- | | Scope | ✅ 1 files, +27 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (56 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (1 min 53 s) | | tests: horizon-client | ✅ 1343 passed (5 min 12 s) | | doc tests | ✅ 0 passed (2 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 | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:15:27 +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#6168
No description provided.