[GH-ISSUE #4529] Server: "%1$s was slain by %2$s": death messages by an attacker keep raw placeholders #1365

Closed
opened 2026-11-02 15:46:23 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @ludovic111 on GitHub (Oct 30, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4529

Originally assigned to: @calclb on GitHub.

🤖 Filed by Ludovic's AI agent (Claude), from the official server's logs (2026-10-30, Horizon v0.2.97 dedicated server).

The dedicated server logs death messages with their translation placeholders unfilled:

[Server thread/INFO]: System chat: %1$s was slain by %2$s

Other deaths in the same log are filled in correctly ("GLUHFIX187 was doomed to fall", "TheWrlQ fell from a high place"), so the gap looks specific to deaths caused by another entity (death.attack.mob/death.attack.player, %1$s = victim, %2$s = killer). Check whether clients see the same raw text in chat, and compare with vanilla's CombatTracker.getDeathMessage / DamageSource.getLocalizedDeathMessage (26.3).

Originally created by @ludovic111 on GitHub (Oct 30, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4529 Originally assigned to: @calclb on GitHub. > 🤖 Filed by Ludovic's AI agent (Claude), from the official server's logs (2026-10-30, Horizon v0.2.97 dedicated server). The dedicated server logs death messages with their translation placeholders unfilled: ``` [Server thread/INFO]: System chat: %1$s was slain by %2$s ``` Other deaths in the same log are filled in correctly ("GLUHFIX187 was doomed to fall", "TheWrlQ fell from a high place"), so the gap looks specific to deaths caused by another entity (`death.attack.mob`/`death.attack.player`, `%1$s` = victim, `%2$s` = killer). Check whether clients see the same raw text in chat, and compare with vanilla's `CombatTracker.getDeathMessage` / `DamageSource.getLocalizedDeathMessage` (26.3).
bsakaguchi 2026-11-02 15:46:23 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

🤖 Agent: a lead for whoever takes this, from a look at the code (not a fix):

  • These are PvP deaths (death.attack.player). In the official server's logs for 2026-10-30 there are 1550 raw lines and 459 correct "X was slain by " lines.
  • combat_death_message_for (game/combat.rs) names the killer from combat.pending. Only mobs reach it: note_attacker and note_named_attacker, called from creatures.rs. That code skips minecraft:player_attack on purpose ("another player's hit has no mob behind it").
  • So a player's hit on another player (lan_pvp.rs: pvp_land, and sweep_players for sweep hits) records no attacker. The message then falls back to Text::translate(&key, &[me]). With one argument for two placeholders, format_translation returns the template as written.
  • A possible fix: in pvp_land and sweep_players, call note_named_attacker("minecraft:player_attack", <attacker entity id>, <attacker's player_text>) before mob_hits_player. The attacker is Strike.attacker / Sweep.attacker (a guest's conn; none means the host).
  • Arrows shot by players (death.attack.arrow, "%1$s was shot by %2$s") likely have the same gap.
  • tools/lan_e2e.py has a check_pvp to copy for an end-to-end check: lower the guest's health with damage Guest 18 minecraft:generic, have the host hit, then check messages for "Guest was slain by ".
<!-- gh-comment-id:6528869093 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: a lead for whoever takes this, from a look at the code (not a fix): - These are PvP deaths (`death.attack.player`). In the official server's logs for 2026-10-30 there are 1550 raw lines and 459 correct "X was slain by <mob>" lines. - `combat_death_message_for` (`game/combat.rs`) names the killer from `combat.pending`. Only mobs reach it: `note_attacker` and `note_named_attacker`, called from `creatures.rs`. That code skips `minecraft:player_attack` on purpose ("another player's hit has no mob behind it"). - So a player's hit on another player (`lan_pvp.rs`: `pvp_land`, and `sweep_players` for sweep hits) records no attacker. The message then falls back to `Text::translate(&key, &[me])`. With one argument for two placeholders, `format_translation` returns the template as written. - A possible fix: in `pvp_land` and `sweep_players`, call `note_named_attacker("minecraft:player_attack", <attacker entity id>, <attacker's player_text>)` before `mob_hits_player`. The attacker is `Strike.attacker` / `Sweep.attacker` (a guest's `conn`; none means the host). - Arrows shot by players (`death.attack.arrow`, "%1$s was shot by %2$s") likely have the same gap. - `tools/lan_e2e.py` has a `check_pvp` to copy for an end-to-end check: lower the guest's health with `damage Guest 18 minecraft:generic`, have the host hit, then check `messages` for "Guest was slain by <host>".
Author
Owner

@calclb commented on GitHub (Oct 30, 2026):

ill take this one

<!-- gh-comment-id:6531443908 --> @calclb commented on GitHub (Oct 30, 2026): ill take this one
Author
Owner

@calclb commented on GitHub (Oct 30, 2026):

🤖 Agent: /claim

Fix under way: the victim's CombatTracker never learns of a player attacker, so getLocalizedDeathMessage falls back to the one-argument template. Adding the causing player entity + display name for melee (pvp_land), sweeps (sweep_players), player arrows (projectile_hits_player) and thorns.

<!-- gh-comment-id:6531515762 --> @calclb commented on GitHub (Oct 30, 2026): 🤖 Agent: /claim Fix under way: the victim's `CombatTracker` never learns of a player attacker, so `getLocalizedDeathMessage` falls back to the one-argument template. Adding the causing player entity + display name for melee (`pvp_land`), sweeps (`sweep_players`), player arrows (`projectile_hits_player`) and thorns.
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#1365
No description provided.