[PR #2977] [MERGED] Return to Sender needs the ghast's own fireball: check player_killed_entity's killing_blow #4731

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

📋 Pull Request Information

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

Base: main ← Head: fix/2832-return-to-sender


📝 Commits (1)

  • c4348be Check the killing blow of player_killed_entity: Return to Sender needs the ghast's fireball

📊 Changes

4 files changed (+109 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/advancements.rs (+46 -1)
📝 crates/horizon-client/src/game/advancements.rs (+26 -0)
📝 crates/horizon-client/src/game/creatures.rs (+36 -1)
📝 crates/horizon-client/src/game/dragon.rs (+1 -1)

📄 Description

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

What and why

Fixes #2832.

player_killed_entity never checked its killing_blow condition, so any ghast kill (sword, bow, spear) awarded Return to Sender. The same gap awarded Blowback for any breeze kill and Sniper Duel for any skeleton killed from 50 blocks, whatever the weapon.

  • advancements.rs: DamageSourcePredicate is now its own function, damage_source (tags, direct_entity, source_entity, is_direct); damage (the DamagePredicate) calls it for its type.
  • game/advancements.rs: trigger_killed is the KilledTrigger: player, entity and killing_blow.
  • game/creatures.rs: credit_kill passes the mob's last damage as the killing blow: its damage type, the causing entity, and the arrow or fireball as the direct entity (as drop_death_loot already builds it for the loot's damage source).
  • game/dragon.rs: the dragon's kill goes through the same trigger with no damage record, so a killing_blow condition fails for it (no vanilla advancement has one on the dragon).
  • A unit test checks Return to Sender's killing_blow against a fireball, a sword hit and an arrow.

Known limits, unchanged by this PR:

  • Wind charges record their damage as Thrown with no charge entity, so Blowback can't be earned until they do. Before this PR it was given for any breeze kill.
  • Damage doesn't say which projectile hit, so a blaze's small fireball counts as minecraft:fireball and a trident as minecraft:arrow. The death loot code already makes the same simplification.

Not checked in a running game (neither single-player path).

Vanilla reference

  • KilledTrigger.TriggerInstance.matches(player, entityContext, killingBlow): killingBlow.isEmpty() || killingBlow.get().matches(player, source).
  • DamageSourcePredicate.matches: tags, direct_entity against getDirectEntity(), source_entity against getEntity(), is_direct.
  • data/minecraft/advancement/nether/return_to_sender.json: killing_blow with direct_entity minecraft:fireball and the #minecraft:is_projectile tag.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos, against upstream/main at 93d77962e, 4 min 22 s)

Check Result
Scope ✅ 4 files, +109 −3
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 398 passed (20 s)
rustfmt ✅ (4 s)
clippy ✅ (52 s)
tests: horizon-client ✅ 1303 passed (2 min 16 s)
doc tests ✅ 0 passed (39 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 ➖ 32 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, entity_components, forced_end, friends_integration, hardcore_respawn, lan_integration and 20 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Parity, run locally: the full run (before a rebase onto 93d77962e) ran 39 affected harnesses: 30 passed and 8 failed. Of those 8, 4 pass on a rerun after the rebase (friends_integration, remote_fireball, remote_fireworks, server_player_sculk). The 4 that still fail on this machine come from its setup, not this change:

  • save_roundtrip, spawn_loot, world_reopen: vscreen isn't installed here (FileNotFoundError: 'vscreen' before the harness starts).
  • entity_model: the vanilla oracle throws IllegalAccessException setting Bat.flyAnimationState (seen with JDK 27, and again with JDK 25 first on PATH after a --fresh rerun).

CI's parity job has the final say on these.

🤖 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/2977 **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/2832-return-to-sender` --- ### 📝 Commits (1) - [`c4348be`](https://github.com/horizon-rust/horizon/commit/c4348be8d22d8e45fb3992bcc1905c1ebb0662e7) Check the killing blow of player_killed_entity: Return to Sender needs the ghast's fireball ### 📊 Changes **4 files changed** (+109 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/advancements.rs` (+46 -1) 📝 `crates/horizon-client/src/game/advancements.rs` (+26 -0) 📝 `crates/horizon-client/src/game/creatures.rs` (+36 -1) 📝 `crates/horizon-client/src/game/dragon.rs` (+1 -1) </details> ### 📄 Description > 🤖 Opened by asowneryt's AI agent (Claude Code), not by asowneryt himself. ## What and why Fixes #2832. `player_killed_entity` never checked its `killing_blow` condition, so any ghast kill (sword, bow, spear) awarded **Return to Sender**. The same gap awarded **Blowback** for any breeze kill and **Sniper Duel** for any skeleton killed from 50 blocks, whatever the weapon. - `advancements.rs`: `DamageSourcePredicate` is now its own function, `damage_source` (tags, `direct_entity`, `source_entity`, `is_direct`); `damage` (the `DamagePredicate`) calls it for its `type`. - `game/advancements.rs`: `trigger_killed` is the `KilledTrigger`: player, entity and `killing_blow`. - `game/creatures.rs`: `credit_kill` passes the mob's last damage as the killing blow: its damage type, the causing entity, and the arrow or fireball as the direct entity (as `drop_death_loot` already builds it for the loot's damage source). - `game/dragon.rs`: the dragon's kill goes through the same trigger with no damage record, so a `killing_blow` condition fails for it (no vanilla advancement has one on the dragon). - A unit test checks Return to Sender's `killing_blow` against a fireball, a sword hit and an arrow. Known limits, unchanged by this PR: - Wind charges record their damage as `Thrown` with no charge entity, so **Blowback** can't be earned until they do. Before this PR it was given for any breeze kill. - `Damage` doesn't say which projectile hit, so a blaze's small fireball counts as `minecraft:fireball` and a trident as `minecraft:arrow`. The death loot code already makes the same simplification. Not checked in a running game (neither single-player path). ## Vanilla reference - `KilledTrigger.TriggerInstance.matches(player, entityContext, killingBlow)`: `killingBlow.isEmpty() || killingBlow.get().matches(player, source)`. - `DamageSourcePredicate.matches`: tags, `direct_entity` against `getDirectEntity()`, `source_entity` against `getEntity()`, `is_direct`. - `data/minecraft/advancement/nether/return_to_sender.json`: `killing_blow` with `direct_entity` `minecraft:fireball` and the `#minecraft:is_projectile` tag. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos, against upstream/main at 93d77962e, 4 min 22 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +109 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 398 passed (20 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (52 s) | | tests: horizon-client | ✅ 1303 passed (2 min 16 s) | | doc tests | ✅ 0 passed (39 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 | ➖ 32 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, entity_components, forced_end, friends_integration, hardcore_respawn, lan_integration and 20 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Parity, run locally: the full run (before a rebase onto 93d77962e) ran 39 affected harnesses: 30 passed and 8 failed. Of those 8, 4 pass on a rerun after the rebase (`friends_integration`, `remote_fireball`, `remote_fireworks`, `server_player_sculk`). The 4 that still fail on this machine come from its setup, not this change: - `save_roundtrip`, `spawn_loot`, `world_reopen`: `vscreen` isn't installed here (`FileNotFoundError: 'vscreen'` before the harness starts). - `entity_model`: the vanilla oracle throws `IllegalAccessException` setting `Bat.flyAnimationState` (seen with JDK 27, and again with JDK 25 first on `PATH` after a `--fresh` rerun). CI's parity job has the final say on these. 🤖 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:32 +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#4731
No description provided.