[PR #2693] [MERGED] Add the missing regression test for #2141: an arrow kills a player at half a heart #4547

Closed
opened 2026-11-03 04:17:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/arrow-death-regression-test


📝 Commits (1)

  • 5721366 Add a regression test: an arrow kills a player at half a heart

📊 Changes

1 file changed (+25 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/health.rs (+25 -0)

📄 Description

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

What and why

#2141 ("Death, couldn't die when shot by skeleton") does not reproduce on the current main: an arrow that takes the last of the player's health kills them, the death screen comes up, the death message is the arrow's, and the respawn is at full health. The behaviour was fixed upstream, but nothing in the tree kept it that way, so this pull request adds the missing regression test.

The test walks the real damage path: the player's health is set to one point (half a heart), the minecraft:arrow damage is applied through the player's own hurt (the same call the server makes when a projectile hits), and the test asserts that the health is spent, that the player is dead, and that the damage was applied at all.

The same behaviour was also checked in a running game (a headless client under horizon-ctl): at 1.0 health an arrow gives the screen dead, the health 0.0 and the message death.attack.arrow ("was shot by"), and the respawn brings the health back to 20.0; with a real skeleton shooting, the screen is dead and the health 0.0.

Fixes #2141

Vanilla reference

  • net.minecraft.world.entity.LivingEntity#hurt — the damage is applied, the health goes to zero, and the entity dies (this.setHealth(0.0F) and this.getHealth() <= 0.0F → kill()).
  • net.minecraft.world.entity.player.Player#die — the player's death (the death message, the death screen and the respawn at full health).
  • net.minecraft.world.damagesource.DamageType / the minecraft:arrow damage — the arrow's damage and its death.attack.arrow message.

Self-check

Check Result
cargo test -p horizon-client --lib -- an_arrow_kills_a_player_at_one_health ✅ 1 passed (health::tests::an_arrow_kills_a_player_at_one_health ... ok)
python3 tools/parity.py server_player_combat ✅ PASS (the composed server-player damage path against the vanilla 26.3 server)
cargo fmt -p horizon-client ✅
python3 tools/check_public_tree.py ✅

🤖 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/2693 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/arrow-death-regression-test` --- ### 📝 Commits (1) - [`5721366`](https://github.com/horizon-rust/horizon/commit/57213668a0be5f67c68e5864182c8bc72d9db031) Add a regression test: an arrow kills a player at half a heart ### 📊 Changes **1 file changed** (+25 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/health.rs` (+25 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself. ## What and why #2141 ("Death, couldn't die when shot by skeleton") does not reproduce on the current `main`: an arrow that takes the last of the player's health kills them, the death screen comes up, the death message is the arrow's, and the respawn is at full health. The behaviour was fixed upstream, but nothing in the tree kept it that way, so this pull request adds the missing regression test. The test walks the real damage path: the player's health is set to one point (half a heart), the `minecraft:arrow` damage is applied through the player's own `hurt` (the same call the server makes when a projectile hits), and the test asserts that the health is spent, that the player is dead, and that the damage was applied at all. The same behaviour was also checked in a running game (a headless client under `horizon-ctl`): at 1.0 health an arrow gives the screen `dead`, the health 0.0 and the message `death.attack.arrow` ("was shot by"), and the respawn brings the health back to 20.0; with a real skeleton shooting, the screen is `dead` and the health 0.0. Fixes #2141 ## Vanilla reference - `net.minecraft.world.entity.LivingEntity#hurt` — the damage is applied, the health goes to zero, and the entity dies (`this.setHealth(0.0F)` and `this.getHealth() <= 0.0F` → `kill()`). - `net.minecraft.world.entity.player.Player#die` — the player's death (the death message, the death screen and the respawn at full health). - `net.minecraft.world.damagesource.DamageType` / the `minecraft:arrow` damage — the arrow's damage and its `death.attack.arrow` message. ## Self-check | Check | Result | | --- | --- | | `cargo test -p horizon-client --lib -- an_arrow_kills_a_player_at_one_health` | ✅ 1 passed (`health::tests::an_arrow_kills_a_player_at_one_health ... ok`) | | `python3 tools/parity.py server_player_combat` | ✅ PASS (the composed server-player damage path against the vanilla 26.3 server) | | `cargo fmt -p horizon-client` | ✅ | | `python3 tools/check_public_tree.py` | ✅ | 🤖 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 04:17:58 +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#4547
No description provided.