[PR #5450] [MERGED] fix(mods): a canceled hit forgets its attackers on every damage path #6295

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

📋 Pull Request Information

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

Base: main ← Head: fix/native-hurt-server-canceled-notes


📝 Commits (2)

  • 742e4dc fix(mods): a canceled hit forgets its attackers on every damage path
  • e33808a Merge main into #5450

📊 Changes

7 files changed (+96 additions, -34 deletions)

View changed files

📝 crates/horizon-client/src/game/combat.rs (+59 -12)
📝 crates/horizon-client/src/game/commands/world_cmds.rs (+4 -1)
📝 crates/horizon-client/src/game/creatures.rs (+14 -9)
📝 crates/horizon-client/src/game/dragon.rs (+6 -2)
📝 crates/horizon-client/src/game/explosion.rs (+1 -0)
📝 crates/horizon-client/src/game/lan_pvp.rs (+4 -5)
📝 crates/horizon-client/src/game/potions.rs (+8 -5)

📄 Description

What and why

Follows #5170

#5170's fix only drops the attackers noted inside hurt_player_from, so a hit the hook cancels on any other path still credits its attacker to the next hit of that type that tick
Those paths are a PvP blow, /damage … by, thorns, the dragon's hits and wing knock, a blast and a potion
On main the attacker is noted at lan_pvp.rs:348, lan_pvp.rs:420/427, commands/world_cmds.rs:190, dragon.rs:2387/2403, explosion.rs:399, potions.rs:1329 and creatures.rs:4326, outside the marks hurt_player_from takes at creatures.rs:3002
The death message and the kill credit then name the wrong entity

The first attacker noted for a hit now records the queue lengths on the combat tracker
Every player-hurt path drops what was noted since then once the hurt is over, and only when the hook canceled it
That covers hurt_player_from, hurt_player_by, a blast on the player, the dragon's wing knock and a potion's hurt, which now read canceled from hurt_blocking
A sweep's blow notes its attacker before the hurt, as the single blow does, and /damage on a spectator notes nothing
Kept to cancels: refused, spectator and absorbed hits behave as before

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 (LivingEntity.java:1192): a canceled hit never runs it, so actuallyHurt (LivingEntity.java:1972) records nothing with CombatTracker.recordDamage (CombatTracker.java:37, called at LivingEntity.java:1984)

Other projects' code

none

Self-check

Check Result
Scope ✅ 7 files, +96 −34
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 508 passed (1 min 2 s)
rustfmt ✅ (9 s)
clippy ✅ (2 min 14 s)
tests: horizon-client ✅ 1537 passed (6 min 2 s)
doc tests ✅ 0 passed (1 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/5450 **Author:** [@reservedbytes](https://github.com/reservedbytes) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/native-hurt-server-canceled-notes` --- ### 📝 Commits (2) - [`742e4dc`](https://github.com/horizon-rust/horizon/commit/742e4dc206e5e4580ac0c588d562c5752407c7cd) fix(mods): a canceled hit forgets its attackers on every damage path - [`e33808a`](https://github.com/horizon-rust/horizon/commit/e33808a648d00b4f2835360b4cd44d802097ee0b) Merge main into #5450 ### 📊 Changes **7 files changed** (+96 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/combat.rs` (+59 -12) 📝 `crates/horizon-client/src/game/commands/world_cmds.rs` (+4 -1) 📝 `crates/horizon-client/src/game/creatures.rs` (+14 -9) 📝 `crates/horizon-client/src/game/dragon.rs` (+6 -2) 📝 `crates/horizon-client/src/game/explosion.rs` (+1 -0) 📝 `crates/horizon-client/src/game/lan_pvp.rs` (+4 -5) 📝 `crates/horizon-client/src/game/potions.rs` (+8 -5) </details> ### 📄 Description ## What and why Follows #5170 #5170's fix only drops the attackers noted inside `hurt_player_from`, so a hit the hook cancels on any other path still credits its attacker to the next hit of that type that tick Those paths are a PvP blow, `/damage … by`, thorns, the dragon's hits and wing knock, a blast and a potion On main the attacker is noted at `lan_pvp.rs:348`, `lan_pvp.rs:420/427`, `commands/world_cmds.rs:190`, `dragon.rs:2387/2403`, `explosion.rs:399`, `potions.rs:1329` and `creatures.rs:4326`, outside the marks `hurt_player_from` takes at `creatures.rs:3002` The death message and the kill credit then name the wrong entity The first attacker noted for a hit now records the queue lengths on the combat tracker Every player-hurt path drops what was noted since then once the hurt is over, and only when the hook canceled it That covers `hurt_player_from`, `hurt_player_by`, a blast on the player, the dragon's wing knock and a potion's hurt, which now read `canceled` from `hurt_blocking` A sweep's blow notes its attacker before the hurt, as the single blow does, and `/damage` on a spectator notes nothing Kept to cancels: refused, spectator and absorbed hits behave as before ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [x] 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` (`LivingEntity.java:1192`): a canceled hit never runs it, so `actuallyHurt` (`LivingEntity.java:1972`) records nothing with `CombatTracker.recordDamage` (`CombatTracker.java:37`, called at `LivingEntity.java:1984`) ## Other projects' code none ## Self-check | Check | Result | | --- | --- | | Scope | ✅ 7 files, +96 −34 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 508 passed (1 min 2 s) | | rustfmt | ✅ (9 s) | | clippy | ✅ (2 min 14 s) | | tests: horizon-client | ✅ 1537 passed (6 min 2 s) | | doc tests | ✅ 0 passed (1 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:17:54 +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#6295
No description provided.