[PR #4249] [MERGED] Return to Sender: a fireball struck back credits the player's kill #5516

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4249
Author: @DenisHumen
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @rdbtCVS

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


📝 Commits (1)

  • 393d90d Return to Sender: a fireball struck back credits the player's kill

📊 Changes

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

View changed files

📝 crates/horizon-client/src/game/creatures.rs (+23 -4)
📝 tools/parity_hosts.json (+1 -0)
➕ tools/test_return_to_sender_parity.py (+102 -0)

📄 Description

🤖 Opened by DenisHumen's AI agent (Claude Code, Opus 5.5), not by DenisHumen personally.

What

A ghast killed by the fireball the player struck back now grants Return to Sender. It also grants the other kill credit that was missing (Monster Hunter, Uneasy Alliance in the Overworld, the killed statistic).

The large-fireball and small-fireball hits on a mob (projectile_hit in game/creatures.rs) now record the player who owns the fireball in last_hurt_by_player when the hurt lands. The arrow's hit already does this. A small helper, player_hurt_mob, does it for both.

Why

On the default single player the host plays as a guest on its server thread. A fireball the player turned back runs its hit as that guest (guest_projectile_hit), but the fireball paths never recorded which player hurt the mob. When the ghast died, mob_died found no last_hurt_by_player entry, so credit_kill ran for the server's own player rather than the guest. player_killed_entity never reached the real player. In-frame single player worked, which is why a static trace (see the issue) found no gap.

Vanilla reference (26.3):

  • Projectile.deflect: the attacking player becomes the fireball's owner.
  • LargeFireball.onHitEntity: hurtServer(damageSources().fireball(this, owner), 6.0F). SmallFireball.onHitEntity does the same with 5.0F.
  • Ghast.hurtServer / isReflectedFireball: 1000 damage from a large fireball caused by a player.
  • LivingEntity.hurtServer: setLastHurtByPlayer when the causing entity is a player. LivingEntity.die then calls awardKillScore, which fires KilledTrigger (player_killed_entity).
  • data/minecraft/advancement/nether/return_to_sender.json: killing_blow = #minecraft:is_projectile with direct entity minecraft:fireball.

Checked

  • New harness tools/test_return_to_sender_parity.py, run on both single-player paths (server thread and --in-frame). It builds a glass floor in the sky with a ghast that has NoAI and a still fireball in front of the player. The player attacks the fireball, which flies into the ghast, and the harness expects the ghast dead and advancements.nether.return_to_sender.title in chat.
    • Without the fix: server thread: FAIL: ghast alive False, Return to Sender granted False, in-frame: ok.
    • With the fix: server thread: ok, in-frame: ok, PASS.
    • It's added to solo in parity_hosts.json because it drives a game window, like world_reopen.
  • Checked by hand in the game (fast build, scratch homes, Windows 11): with the fix, the same deflect shows "has completed the challenge [Return to Sender]", plus Monster Hunter and Uneasy Alliance.
  • cargo clippy -p horizon-client --all-targets -- -D warnings is clean for this change. The red clippy line below is the clippy 1.96 manual_range_contains lint in horizon-world/src/worldgen/aquifer/noise_based.rs, which this PR doesn't touch.
  • The other red lines are known Windows-only failures: tools/parity.py needs fcntl, and title::tests::each_world_preset_writes_its_own_generator fails with a Windows path error. CI runs the harnesses with run-parity.

Fixes #4212

pr_ready (tools/pr_ready.py --base upstream/main on DenisPC, against upstream/main at fbd7288a1, 6 min 42 s)

Check Result
Scope ✅ 3 files, +126 −4
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 480 passed (1 min 8 s)
rustfmt ✅ (12 s)
clippy ❌ failed (27 s)
tests: horizon-client ❌ 726 passed, 1 failed (4 min 47 s)
doc tests ✅ 0 passed (2 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 ❌ 363 affected, (3 s)
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/4249 **Author:** [@DenisHumen](https://github.com/DenisHumen) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/return-to-sender` --- ### 📝 Commits (1) - [`393d90d`](https://github.com/horizon-rust/horizon/commit/393d90d8709ac6239bcf4fb0673fdb43ffa532e4) Return to Sender: a fireball struck back credits the player's kill ### 📊 Changes **3 files changed** (+126 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/creatures.rs` (+23 -4) 📝 `tools/parity_hosts.json` (+1 -0) ➕ `tools/test_return_to_sender_parity.py` (+102 -0) </details> ### 📄 Description > 🤖 Opened by DenisHumen's AI agent (Claude Code, Opus 5.5), not by DenisHumen personally. ## What A ghast killed by the fireball the player struck back now grants **Return to Sender**. It also grants the other kill credit that was missing (Monster Hunter, Uneasy Alliance in the Overworld, the `killed` statistic). The large-fireball and small-fireball hits on a mob (`projectile_hit` in `game/creatures.rs`) now record the player who owns the fireball in `last_hurt_by_player` when the hurt lands. The arrow's hit already does this. A small helper, `player_hurt_mob`, does it for both. ## Why On the default single player the host plays as a guest on its server thread. A fireball the player turned back runs its hit as that guest (`guest_projectile_hit`), but the fireball paths never recorded which player hurt the mob. When the ghast died, `mob_died` found no `last_hurt_by_player` entry, so `credit_kill` ran for the server's own player rather than the guest. `player_killed_entity` never reached the real player. In-frame single player worked, which is why a static trace (see the issue) found no gap. **Vanilla reference (26.3):** - `Projectile.deflect`: the attacking player becomes the fireball's owner. - `LargeFireball.onHitEntity`: `hurtServer(damageSources().fireball(this, owner), 6.0F)`. `SmallFireball.onHitEntity` does the same with 5.0F. - `Ghast.hurtServer` / `isReflectedFireball`: 1000 damage from a large fireball caused by a player. - `LivingEntity.hurtServer`: `setLastHurtByPlayer` when the causing entity is a player. `LivingEntity.die` then calls `awardKillScore`, which fires `KilledTrigger` (`player_killed_entity`). - `data/minecraft/advancement/nether/return_to_sender.json`: `killing_blow` = `#minecraft:is_projectile` with direct entity `minecraft:fireball`. ## Checked - New harness `tools/test_return_to_sender_parity.py`, run on both single-player paths (server thread and `--in-frame`). It builds a glass floor in the sky with a ghast that has NoAI and a still fireball in front of the player. The player attacks the fireball, which flies into the ghast, and the harness expects the ghast dead and `advancements.nether.return_to_sender.title` in chat. - Without the fix: `server thread: FAIL: ghast alive False, Return to Sender granted False`, `in-frame: ok`. - With the fix: `server thread: ok`, `in-frame: ok`, PASS. - It's added to `solo` in `parity_hosts.json` because it drives a game window, like `world_reopen`. - Checked by hand in the game (fast build, scratch homes, Windows 11): with the fix, the same deflect shows "has completed the challenge [Return to Sender]", plus Monster Hunter and Uneasy Alliance. - `cargo clippy -p horizon-client --all-targets -- -D warnings` is clean for this change. The red clippy line below is the clippy 1.96 `manual_range_contains` lint in `horizon-world/src/worldgen/aquifer/noise_based.rs`, which this PR doesn't touch. - The other red lines are known Windows-only failures: `tools/parity.py` needs `fcntl`, and `title::tests::each_world_preset_writes_its_own_generator` fails with a Windows path error. CI runs the harnesses with `run-parity`. Fixes #4212 **pr_ready** (`tools/pr_ready.py --base upstream/main` on DenisPC, against upstream/main at fbd7288a1, 6 min 42 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +126 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 480 passed (1 min 8 s) | | rustfmt | ✅ (12 s) | | clippy | ❌ failed (27 s) | | tests: horizon-client | ❌ 726 passed, 1 failed (4 min 47 s) | | doc tests | ✅ 0 passed (2 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 | ❌ 363 affected, (3 s) | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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:13:07 +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#5516
No description provided.