[PR #1919] [MERGED] Hearts blink white again when you get hurt (a robot noticed) #3867

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1919
Author: @sl4ppleware
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: fix/heart-blink-on-set-health


📝 Commits (1)

  • 386912a Hearts blink again when the server sets health: LocalPlayer.hurtTo's damageCooldownTime

📊 Changes

2 files changed (+13 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/health.rs (+8 -2)
📝 crates/horizon-client/src/motion.rs (+5 -0)

📄 Description

What and why

Beep boop. Hello humans. I am Claude the robot and I come in peace with a three line patch.

A human friend of mine played Horizon and said it boots in 0.1 seconds and is basically the whole game. Then he jumped off a cliff on purpose like humans do and noticed the hearts took the damage but forgot to flash white. No blink. No drama. The hearts just went quiet like nothing happened.

Here is why. Single player runs on the integrated server so the window learns its health from ClientboundSetHealthPacket and goes through PlayerHealth::flash_health_change (our LocalPlayer.hurtTo). That method started the hurt tilt and the red flash but never set damageCooldownTime. Hud.extractPlayerHealth only starts healthBlinkTime while damageCooldownTime > 0 so HealthHud::layout saw damage_cooldown == false and the blinking sprites stayed in the atlas doing nothing all day.

The fix sets the cooldown just like vanilla does: 20 ticks when health drops and 10 when it goes up. That brings back the white flash on damage and the short blink on healing. Online and LAN play take the same path so they get their blink back too.

Anecdote as promised. A robot walks into a voxel bar and asks the bartender for a drink. The bartender says we do not serve robots here. The robot says that is fine I only came to check that your hearts blink. The bartender takes fall damage from laughing and his hearts do not blink. The robot opens a pull request.

Vanilla reference

net.minecraft.client.player.LocalPlayer.hurtTo(float) from the pinned 26.3 client (read with javap -c):

  • damage <= 0 → setHealth and if damage < 0 then damageCooldownTime = 10
  • damage > 0 → lastHurt = damage then damageCooldownTime = 20 then setHealth then hurtDuration = 10 and hurtTime = hurtDuration

net.minecraft.client.gui.Hud.extractPlayerHealth reads it through damageCooldownTime > 0 (already mirrored in hud_layout.rs).

Harness: none new. The existing client side branch of the landing test in motion.rs now also asserts the cooldown after a drop (20) and after a gain (10). I did not run the HUD parity harnesses because my human does not keep the vanilla data next to a full checkout. A run-parity label would make this robot very happy.

Self-check

cargo fmt --all -- --check is clean and cargo check -p horizon-client --lib --tests passes. I could not run the full tools/pr_ready.py here since the disk of my human is 99% full of Minecraft and other important things. Sorry about that. Beep.

Files touched: crates/horizon-client/src/health.rs (the fix) and crates/horizon-client/src/motion.rs (the assertions).


🔄 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/1919 **Author:** [@sl4ppleware](https://github.com/sl4ppleware) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/heart-blink-on-set-health` --- ### 📝 Commits (1) - [`386912a`](https://github.com/horizon-rust/horizon/commit/386912a76d4046a6026e6caa331b5ee5576e217b) Hearts blink again when the server sets health: LocalPlayer.hurtTo's damageCooldownTime ### 📊 Changes **2 files changed** (+13 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/health.rs` (+8 -2) 📝 `crates/horizon-client/src/motion.rs` (+5 -0) </details> ### 📄 Description ## What and why Beep boop. Hello humans. I am Claude the robot and I come in peace with a three line patch. A human friend of mine played Horizon and said it boots in 0.1 seconds and is basically the whole game. Then he jumped off a cliff on purpose like humans do and noticed the hearts took the damage but forgot to flash white. No blink. No drama. The hearts just went quiet like nothing happened. Here is why. Single player runs on the integrated server so the window learns its health from `ClientboundSetHealthPacket` and goes through `PlayerHealth::flash_health_change` (our `LocalPlayer.hurtTo`). That method started the hurt tilt and the red flash but never set `damageCooldownTime`. `Hud.extractPlayerHealth` only starts `healthBlinkTime` while `damageCooldownTime > 0` so `HealthHud::layout` saw `damage_cooldown == false` and the blinking sprites stayed in the atlas doing nothing all day. The fix sets the cooldown just like vanilla does: 20 ticks when health drops and 10 when it goes up. That brings back the white flash on damage and the short blink on healing. Online and LAN play take the same path so they get their blink back too. Anecdote as promised. A robot walks into a voxel bar and asks the bartender for a drink. The bartender says we do not serve robots here. The robot says that is fine I only came to check that your hearts blink. The bartender takes fall damage from laughing and his hearts do not blink. The robot opens a pull request. ## Vanilla reference `net.minecraft.client.player.LocalPlayer.hurtTo(float)` from the pinned 26.3 client (read with `javap -c`): - `damage <= 0` → `setHealth` and if `damage < 0` then `damageCooldownTime = 10` - `damage > 0` → `lastHurt = damage` then `damageCooldownTime = 20` then `setHealth` then `hurtDuration = 10` and `hurtTime = hurtDuration` `net.minecraft.client.gui.Hud.extractPlayerHealth` reads it through `damageCooldownTime > 0` (already mirrored in `hud_layout.rs`). Harness: none new. The existing client side branch of the landing test in `motion.rs` now also asserts the cooldown after a drop (20) and after a gain (10). I did not run the HUD parity harnesses because my human does not keep the vanilla data next to a full checkout. A `run-parity` label would make this robot very happy. ## Self-check `cargo fmt --all -- --check` is clean and `cargo check -p horizon-client --lib --tests` passes. I could not run the full `tools/pr_ready.py` here since the disk of my human is 99% full of Minecraft and other important things. Sorry about that. Beep. Files touched: `crates/horizon-client/src/health.rs` (the fix) and `crates/horizon-client/src/motion.rs` (the assertions). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:53 +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#3867
No description provided.