[PR #4927] [MERGED] Name the attacking and diying player in PvP death messages #5948

Closed
opened 2026-11-03 05:16:08 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4927
Author: @Web-mc1
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix-pvp-death-message


📝 Commits (1)

  • 23f917e Name the attacking player in PvP death messages

📊 Changes

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

View changed files

📝 crates/horizon-client/src/game/lan_pvp.rs (+16 -0)

📄 Description

Opened by Web-mc1's

What and why

A player killed by another player gets the raw template "%1$s was slain by %2$s" as their death message, with no names filled in.

Cause: hurt_player_from skips the attacker lookup for minecraft:player_attack (the lookup only knows mobs). The combat tracker then records no killer, and combat_death_message_for falls through to the one-argument Text::translate(&key, &[me]). format_translation returns the template as written when it has fewer arguments than slots.

Fix: pvp_land now records the attacking player (entity id and display name, for a guest or the host) with note_named_attacker before the hit lands, so the death message gets both names. 16 lines in lan_pvp.rs.

Not tested in a real two-player game yet; it compiles and passes the self-check below.

Fixes #

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

CombatTracker.getDeathMessage and DamageSource.getLocalizedDeathMessage (the causing entity's display name is the second argument of death.attack.player). No new harness: I could not run the vanilla data harnesses here, so no parity result either. tools/test_server_player_combat_parity.py and tools/test_registered_player_combat_parity.py are the natural place for a death-message case if you want one.

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on etienne-pc, against upstream/main at 3dc5b432f, 3 min 56 s)

Check Result
Scope ✅ 2 files, +90 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 486 passed (54 s)
rustfmt ✅ (11 s)
clippy ✅ (1 min 49 s)
tests: horizon-client ✅ 1285 passed (59 s)
doc tests ✅ 0 passed (3 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 (no vanilla data here): 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)

(The "2 files, +90" scope counted an untracked local patch file that is not part of this PR; the PR changes only crates/horizon-client/src/game/lan_pvp.rs, +16.)


🔄 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/4927 **Author:** [@Web-mc1](https://github.com/Web-mc1) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix-pvp-death-message` --- ### 📝 Commits (1) - [`23f917e`](https://github.com/horizon-rust/horizon/commit/23f917e309d6e203f0f7fd877d6242911964b8ae) Name the attacking player in PvP death messages ### 📊 Changes **1 file changed** (+16 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/lan_pvp.rs` (+16 -0) </details> ### 📄 Description > Opened by Web-mc1's ## What and why A player killed by another player gets the raw template "%1$s was slain by %2$s" as their death message, with no names filled in. Cause: `hurt_player_from` skips the attacker lookup for `minecraft:player_attack` (the lookup only knows mobs). The combat tracker then records no killer, and `combat_death_message_for` falls through to the one-argument `Text::translate(&key, &[me])`. `format_translation` returns the template as written when it has fewer arguments than slots. Fix: `pvp_land` now records the attacking player (entity id and display name, for a guest or the host) with `note_named_attacker` before the hit lands, so the death message gets both names. 16 lines in `lan_pvp.rs`. Not tested in a real two-player game yet; it compiles and passes the self-check below. Fixes #<issue> ## 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 `CombatTracker.getDeathMessage` and `DamageSource.getLocalizedDeathMessage` (the causing entity's display name is the second argument of `death.attack.player`). No new harness: I could not run the vanilla data harnesses here, so no parity result either. `tools/test_server_player_combat_parity.py` and `tools/test_registered_player_combat_parity.py` are the natural place for a death-message case if you want one. ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on etienne-pc, against upstream/main at 3dc5b432f, 3 min 56 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +90 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 486 passed (54 s) | | rustfmt | ✅ (11 s) | | clippy | ✅ (1 min 49 s) | | tests: horizon-client | ✅ 1285 passed (59 s) | | doc tests | ✅ 0 passed (3 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 (no vanilla data here): 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) | (The "2 files, +90" scope counted an untracked local patch file that is not part of this PR; the PR changes only `crates/horizon-client/src/game/lan_pvp.rs`, +16.) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:08 +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#5948
No description provided.