[PR #2938] [MERGED] Name the projectile in the death message when it has no owner #4694

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2938
Author: @ASOwnerYT
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @ludovic111

Base: main ← Head: fix/2802-projectile-death-message


📝 Commits (2)

  • 53cb3a1 Name the projectile in the death message when it has no owner
  • 513aed6 Merge upstream main into fix/2802-projectile-death-message

📊 Changes

2 files changed (+30 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/combat.rs (+6 -0)
📝 crates/horizon-client/src/game/creatures.rs (+24 -0)

📄 Description

🤖 Opened by asowneryt's AI agent (Claude Code), not by asowneryt himself.

What and why

Fixes #2802.

A player killed by a projectile with no living owner (an arrow from /summon or a dispenser, or one whose shooter is gone) got the raw template as their death message: %1$s was shot by %2$s.

The cause is not format_translation. Vanilla does the same thing there: TranslatableContents.getArgument throws for a missing argument, and decompose then shows the whole template as it is. So the change the issue proposes for text.rs would move away from vanilla. The gap is in the combat tracker. Vanilla's DamageSource for a projectile hit always has an entity:

  • AbstractArrow.onHitEntity (arrows, tridents) makes the arrow itself the causing entity when it has no owner.
  • Fireballs, llama spit and shulker bullets are the source's directEntity.

getLocalizedDeathMessage then names that entity: Player was shot by Arrow. Horizon recorded no entity for those hits, so it fell back to the one-argument form.

Now projectile_hit remembers the projectile's display name (entity.minecraft.arrow, spectral_arrow, trident, fireball...) when it hits a player. hurt_player_from notes it as the hit's direct entity, and record_combat already uses that only when no attacker is known. A projectile with a living owner still names the owner. Guests (server thread, LAN, dedicated) take the same path through as_guest, which swaps the combat tracker.

Vanilla reference

  • net.minecraft.world.entity.projectile.arrow.AbstractArrow#onHitEntity (damageSources().arrow(this, owner != null ? owner : this))
  • net.minecraft.world.damagesource.DamageSource#getLocalizedDeathMessage
  • net.minecraft.network.chat.contents.TranslatableContents#decompose, #getArgument (unchanged here: they match Horizon already)

No harness covers death messages. Checked in the game (server-thread path, horizon-ctl): /damage @s 19, then /summon minecraft:arrow ~ ~3 ~ {Motion:[0.0,-2.0,0.0],damage:6.0d} gives Player03947 was shot by Arrow (death.attack.arrow with the player's name and entity.minecraft.arrow). I didn't run the same test without the fix.

Self-check

pr_ready (tools/pr_ready.py --base upstream/main on cachyos, against upstream/main at 1e3a9d53a, 35 min 30 s)

Check Result
Scope ✅ 2 files, +30 −0
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 336 passed (16 s)
rustfmt ✅ (5 s)
clippy ✅ (1 min 19 s)
tests: horizon-client ✅ 1329 passed (2 min 13 s)
doc tests ✅ 0 passed (38 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 ❌ 38 affected, 29 passed, failed: entity_model, friends_integration, remote_fireball, remote_fireworks, save_roundtrip, server_player_sculk, spawn_loot, world_reopen (30 min 57 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

None of the 8 parity failures comes from this change. They were problems with this machine and one oracle bug, now fixed in their own PRs:

  • save_roundtrip, world_reopen, spawn_loot (no vscreen here), and remote_fireball, remote_fireworks, server_player_sculk, friends_integration (without vscreen, the LAN host's window never got focus and paused before its world loaded): #2940.
  • entity_model: the oracle's bat case set a final field without setAccessible (IllegalAccessException on every JDK; the Rust side had 0 layers differing): #2941.

With both of those applied locally on top of this branch (not part of this PR), all 8 pass:

PASS remote_fireworks 46s
PASS remote_fireball 51s
PASS server_player_sculk 58s
PASS entity_model 8s
PASS friends_integration 16s
PASS spawn_loot 24s
PASS world_reopen 19s
PASS save_roundtrip 94s
8 passed, 0 failed in 1.6 min.

🤖 Generated with Claude Code


🔄 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/2938 **Author:** [@ASOwnerYT](https://github.com/ASOwnerYT) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/2802-projectile-death-message` --- ### 📝 Commits (2) - [`53cb3a1`](https://github.com/horizon-rust/horizon/commit/53cb3a19d1532da40470ec3fcf831566ed9fda37) Name the projectile in the death message when it has no owner - [`513aed6`](https://github.com/horizon-rust/horizon/commit/513aed64c52c40048e4af724318c88ec0ea68822) Merge upstream main into fix/2802-projectile-death-message ### 📊 Changes **2 files changed** (+30 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/combat.rs` (+6 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+24 -0) </details> ### 📄 Description > 🤖 Opened by asowneryt's AI agent (Claude Code), not by asowneryt himself. ## What and why Fixes #2802. A player killed by a projectile with no living owner (an arrow from `/summon` or a dispenser, or one whose shooter is gone) got the raw template as their death message: `%1$s was shot by %2$s`. The cause is not `format_translation`. Vanilla does the same thing there: `TranslatableContents.getArgument` throws for a missing argument, and `decompose` then shows the whole template as it is. So the change the issue proposes for `text.rs` would move away from vanilla. The gap is in the combat tracker. Vanilla's `DamageSource` for a projectile hit always has an entity: - `AbstractArrow.onHitEntity` (arrows, tridents) makes the arrow itself the causing entity when it has no owner. - Fireballs, llama spit and shulker bullets are the source's `directEntity`. `getLocalizedDeathMessage` then names that entity: `Player was shot by Arrow`. Horizon recorded no entity for those hits, so it fell back to the one-argument form. Now `projectile_hit` remembers the projectile's display name (`entity.minecraft.arrow`, `spectral_arrow`, `trident`, `fireball`...) when it hits a player. `hurt_player_from` notes it as the hit's direct entity, and `record_combat` already uses that only when no attacker is known. A projectile with a living owner still names the owner. Guests (server thread, LAN, dedicated) take the same path through `as_guest`, which swaps the combat tracker. ## Vanilla reference - `net.minecraft.world.entity.projectile.arrow.AbstractArrow#onHitEntity` (`damageSources().arrow(this, owner != null ? owner : this)`) - `net.minecraft.world.damagesource.DamageSource#getLocalizedDeathMessage` - `net.minecraft.network.chat.contents.TranslatableContents#decompose`, `#getArgument` (unchanged here: they match Horizon already) No harness covers death messages. Checked in the game (server-thread path, `horizon-ctl`): `/damage @s 19`, then `/summon minecraft:arrow ~ ~3 ~ {Motion:[0.0,-2.0,0.0],damage:6.0d}` gives `Player03947 was shot by Arrow` (`death.attack.arrow` with the player's name and `entity.minecraft.arrow`). I didn't run the same test without the fix. ## Self-check **pr_ready** (`tools/pr_ready.py --base upstream/main` on cachyos, against upstream/main at 1e3a9d53a, 35 min 30 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +30 −0 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 336 passed (16 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 min 19 s) | | tests: horizon-client | ✅ 1329 passed (2 min 13 s) | | doc tests | ✅ 0 passed (38 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 | ❌ 38 affected, 29 passed, failed: entity_model, friends_integration, remote_fireball, remote_fireworks, save_roundtrip, server_player_sculk, spawn_loot, world_reopen (30 min 57 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | None of the 8 parity failures comes from this change. They were problems with this machine and one oracle bug, now fixed in their own PRs: - `save_roundtrip`, `world_reopen`, `spawn_loot` (no `vscreen` here), and `remote_fireball`, `remote_fireworks`, `server_player_sculk`, `friends_integration` (without `vscreen`, the LAN host's window never got focus and paused before its world loaded): #2940. - `entity_model`: the oracle's bat case set a final field without `setAccessible` (`IllegalAccessException` on every JDK; the Rust side had 0 layers differing): #2941. With both of those applied locally on top of this branch (not part of this PR), all 8 pass: ``` PASS remote_fireworks 46s PASS remote_fireball 51s PASS server_player_sculk 58s PASS entity_model 8s PASS friends_integration 16s PASS spawn_loot 24s PASS world_reopen 19s PASS save_roundtrip 94s 8 passed, 0 failed in 1.6 min. ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:14 +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#4694
No description provided.