[GH-ISSUE #1825] [server-thread] Death messages ignore the damage source (always "X died") #549

Closed
opened 2026-11-02 15:39:56 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Excurs1ons on GitHub (Oct 25, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1825

[server-thread] Death messages ignore the damage source (always "X died")

🤖 Filed by Excurs1ons's AI agent (OpenCode), not by Excurs1ons himself.

What happens

On the default server-thread path, and for LAN guests and dedicated-server players, every death except
/kill shows the generic message:

  • chat: Player died
  • death screen: the same line

Vanilla names the cause and the killer. The wither is a good example: its skulls use
death.attack.witherSkull (%1$s was shot by a skull from %2$s), so the chat line and the death screen
carry the same text:

  • en_us: Player was shot by a skull from Wither
  • zh_cn: Player被凋灵发射的头颅射杀

Expected (vanilla)

ServerPlayer.die asks CombatTracker.getDeathMessage(), which builds the line from the damage source in
the last entry (plus the most significant fall), for example:

Cause Key en_us
mob death.attack.mob %1$s was slain by %2$s
player death.attack.player %1$s was slain by %2$s
arrow death.attack.arrow %1$s was shot by %2$s
wither skull death.attack.witherSkull %1$s was shot by a skull from %2$s
wither effect death.attack.wither %1$s withered away
fall death.attack.fall %1$s hit the ground too hard
fall variants death.fell.accident.*, death.fell.assist, death.fell.finish, death.fell.killer
lava / fire / drowning death.attack.lava / death.attack.onFire / death.attack.drown %1$s tried to swim in lava / burned to death / drowned
explosion death.attack.explosion.player %1$s was blown up by %2$s
/kill death.attack.genericKill %1$s died

A mob kill with a named weapon also appends the death.attack.*.item "using [item]" suffix. The chat
broadcast obeys showDeathMessages; the dying player's packet (ClientboundPlayerCombatKillPacket) always
carries the message, so the death screen shows it even with the rule off.

Reproduction

Build target/fast/horizon-client.exe and start a world on the default path (no --in-frame), English
client:

/summon minecraft:wither 0 80 0
/gamemode survival

Stand next to the wither until it kills you.

  • Actual: Player died in chat, and the death screen shows that same line.
  • Expected: Player was shot by a skull from Wither in both, with the wither's display name in %2$s
    (zh_cn: Player被凋灵发射的头颅射杀).

The same happens with a skeleton's arrow (was shot by Skeleton) and a plain fall
(hit the ground too hard).

Why

  • The server-side death path reads only death_cause:
    crates/horizon-client/src/game/lan_actions.rs:1795 (host.play[conn].death_cause.take()), falling back
    to death.attack.generic (:1800) or death.attack.outOfWorld.
  • death_cause is set in exactly one place, the /kill command:
    crates/horizon-client/src/game/commands.rs:1529 (death.attack.genericKill).
  • The skull hit already carries its damage type on the in-frame path
    (crates/horizon-client/src/game/wither.rs:139, minecraft:wither_skull); the server-side player's
    damage and death record does not keep it.
  • A full CombatTracker port already exists — crates/horizon-client/src/game/combat.rs
    (combat_death_message, around :193), used by the in-frame local player through
    crates/horizon-client/src/game/chat.rs:824. In-frame singleplayer therefore names the cause; the
    server-thread window, LAN guests and dedicated-server players do not.

So this is an unfinished port (no damage-source record for server-side players), not a regression: it has
never worked outside in-frame. It becomes visible on the default path because the window is a client of its
own server.

Fix sketch

  • Record the DamageSource (damage type id, attacker id and name, fall distance) for guest damage in the
    serving Game, the way note_attacker/record_combat do for the in-frame player.
  • On death, build one Text with combat_death_message (or the same key selection) and use it for both the
    combat-kill packet and the chat broadcast, so the death screen and chat cannot show different lines.
  • Keep death_cause for /kill; always send the message to the death screen, and gate only the chat
    broadcast on showDeathMessages.
  • Cover the death.attack.*.item suffix when the killer's weapon has a custom name.

Environment

  • Horizon 26.3 (current main at the time of writing), Windows, default server-thread path.
  • Related but separate: #1774 / PR #1806 localize the generic fallback; they do not add damage-source
    tracking.
Originally created by @Excurs1ons on GitHub (Oct 25, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/1825 # [server-thread] Death messages ignore the damage source (always "X died") > 🤖 Filed by Excurs1ons's AI agent (OpenCode), not by Excurs1ons himself. ## What happens On the default server-thread path, and for LAN guests and dedicated-server players, every death except `/kill` shows the generic message: - chat: `Player died` - death screen: the same line Vanilla names the cause and the killer. The wither is a good example: its skulls use `death.attack.witherSkull` (`%1$s was shot by a skull from %2$s`), so the chat line and the death screen carry the same text: - en_us: `Player was shot by a skull from Wither` - zh_cn: `Player被凋灵发射的头颅射杀` ## Expected (vanilla) `ServerPlayer.die` asks `CombatTracker.getDeathMessage()`, which builds the line from the damage source in the last entry (plus the most significant fall), for example: | Cause | Key | en_us | | --- | --- | --- | | mob | `death.attack.mob` | `%1$s was slain by %2$s` | | player | `death.attack.player` | `%1$s was slain by %2$s` | | arrow | `death.attack.arrow` | `%1$s was shot by %2$s` | | wither skull | `death.attack.witherSkull` | `%1$s was shot by a skull from %2$s` | | wither effect | `death.attack.wither` | `%1$s withered away` | | fall | `death.attack.fall` | `%1$s hit the ground too hard` | | fall variants | `death.fell.accident.*`, `death.fell.assist`, `death.fell.finish`, `death.fell.killer` | | | lava / fire / drowning | `death.attack.lava` / `death.attack.onFire` / `death.attack.drown` | `%1$s tried to swim in lava` / `burned to death` / `drowned` | | explosion | `death.attack.explosion.player` | `%1$s was blown up by %2$s` | | `/kill` | `death.attack.genericKill` | `%1$s died` | A mob kill with a named weapon also appends the `death.attack.*.item` "using [item]" suffix. The chat broadcast obeys `showDeathMessages`; the dying player's packet (`ClientboundPlayerCombatKillPacket`) always carries the message, so the death screen shows it even with the rule off. ## Reproduction Build `target/fast/horizon-client.exe` and start a world on the default path (no `--in-frame`), English client: ``` /summon minecraft:wither 0 80 0 /gamemode survival ``` Stand next to the wither until it kills you. - Actual: `Player died` in chat, and the death screen shows that same line. - Expected: `Player was shot by a skull from Wither` in both, with the wither's display name in `%2$s` (zh_cn: `Player被凋灵发射的头颅射杀`). The same happens with a skeleton's arrow (`was shot by Skeleton`) and a plain fall (`hit the ground too hard`). ## Why - The server-side death path reads only `death_cause`: `crates/horizon-client/src/game/lan_actions.rs:1795` (`host.play[conn].death_cause.take()`), falling back to `death.attack.generic` (`:1800`) or `death.attack.outOfWorld`. - `death_cause` is set in exactly one place, the `/kill` command: `crates/horizon-client/src/game/commands.rs:1529` (`death.attack.genericKill`). - The skull hit already carries its damage type on the in-frame path (`crates/horizon-client/src/game/wither.rs:139`, `minecraft:wither_skull`); the server-side player's damage and death record does not keep it. - A full `CombatTracker` port already exists — `crates/horizon-client/src/game/combat.rs` (`combat_death_message`, around `:193`), used by the in-frame local player through `crates/horizon-client/src/game/chat.rs:824`. In-frame singleplayer therefore names the cause; the server-thread window, LAN guests and dedicated-server players do not. So this is an unfinished port (no damage-source record for server-side players), not a regression: it has never worked outside in-frame. It becomes visible on the default path because the window is a client of its own server. ## Fix sketch - Record the `DamageSource` (damage type id, attacker id and name, fall distance) for guest damage in the serving `Game`, the way `note_attacker`/`record_combat` do for the in-frame player. - On death, build one `Text` with `combat_death_message` (or the same key selection) and use it for both the combat-kill packet and the chat broadcast, so the death screen and chat cannot show different lines. - Keep `death_cause` for `/kill`; always send the message to the death screen, and gate only the chat broadcast on `showDeathMessages`. - Cover the `death.attack.*.item` suffix when the killer's weapon has a custom name. ## Environment - Horizon 26.3 (current main at the time of writing), Windows, default server-thread path. - Related but separate: #1774 / PR #1806 localize the generic fallback; they do not add damage-source tracking.
Author
Owner

@ludovic111 commented on GitHub (Oct 25, 2026):

Claimed by Excursions on Discord, to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #1825).

<!-- gh-comment-id:6400300792 --> @ludovic111 commented on GitHub (Oct 25, 2026): Claimed by `Excursions` on Discord, to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #1825). <!-- kira:work -->
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#549
No description provided.