[PR #1648] [MERGED] A client's own fall no longer shakes the screen: the server's hurt starts the tilt #3658

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

📋 Pull Request Information

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

Base: main ← Head: fix/remote-fall-hurt


📝 Commits (1)

  • d604409 A client's own fall no longer hurts it: the server's hurt starts the tilt

📊 Changes

5 files changed (+105 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/game/agent.rs (+2 -0)
📝 crates/horizon-client/src/game/remote.rs (+24 -4)
📝 crates/horizon-client/src/health.rs (+19 -0)
📝 crates/horizon-client/src/hunger.rs (+3 -0)
📝 crates/horizon-client/src/motion.rs (+57 -0)

📄 Description

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

What

On a server that cancels fall damage (lobbies with double jump; vanilla 26.3's /gamerule fall_damage false gives the client the same situation), Horizon's screen tilted on landing as if hurt, though health stayed full. Reported on Discord on 2026-10-24.

Cause: as a client (remote: multiplayer, a LAN guest, single player on its server thread) Horizon still ran its own predicted damage through the local hurt: fall damage (landing.rs FallCall::hurt), and also fire, lava, freezing, sweet berry bushes, cactus/magma, the void and in-wall damage (environment_hurt, freeze_damage), plus starvation (food_tick). The hurt set hurt_animation_time, and bob_hurt tilted the camera. apply_remote_health then put the health back, but left the tilt running.

Vanilla 26.3

  • Entity.hurt only hurts in a ServerLevel. LivingEntity.causeFallDamage still runs on the client and plays the fall sounds through LocalPlayer.playSound, but its this.hurt(...) does nothing there. FoodData.tick runs from ServerPlayer.tick only.
  • The client's own hurt animation (hurtTime/hurtDuration, which GameRenderer.bobHurt reads) comes from the server in three ways:
    • LocalPlayer.hurtTo (handleSetHealth): once flashOnSetHealth is set by the first health packet, a drop starts it;
    • handleDamageEvent → LivingEntity.handleDamageEvent;
    • handleHurtAnimation → animateHurt. The server sends both of these to the hurt player as well (sendToTrackingPlayersAndSelf).

How

  • PlayerMotion.client_side, set in tick_remote. While it is set, hurt_blocking and food_tick do nothing. Landing, fall-distance tracking and the fall sounds work as before.
  • remote.rs: on SetHealth, flash_health_change follows hurtTo. A DamageEvent or HurtAnimation for the player's own entity id calls animate_hurt. Before this change, only mobs handled those two packets.
  • horizon-ctl state now reports the player's hurt_time, so the tilt can be checked from outside the game.
  • Regression test: motion::tests::a_clients_own_fall_does_not_hurt_it. A 30-block landing with client_side set plays big_fall and leaves health and hurt time unchanged. Without the flag the same landing hurts. A health drop sent afterwards starts the hurt animation.

Evidence

The client falls 20 blocks (tp ~ ~20 ~), then horizon-ctl hurtlog and state are polled every 100 ms.

Setup main this branch
Vanilla 26.3 dedicated server, fall_damage false client hurtlog: fall 17.0, hurt: true (local health 3, tilt), server health 20 hurtlog empty, hurt_time stays 0, health 20
Vanilla 26.3 server, fall_damage true SetHealth 3 → hurt_time 10, 6, 1 (tilt from the server)
Horizon server thread (default) client hurtlog empty, hurt_time 10 → 3, health 3 (from the server)
Horizon --in-frame the local game is the server: fall 17, hurt: true, hurt_time 10
Horizon dedicated server client hurtlog empty, hurt_time 9, 5, 1, health 3

lan_e2e.py --check damage hazards contacts ladder lava mobs hurt: all 7 pass with the host in-frame and all 7 pass with --server-thread.

Self-check

Run on the Mac mini at bb1ec3fa3; the diff is the same after the rebase onto main (d604409be). tools/pr_ready.py was stopped by the session's 2 h limit while it ran the harnesses, so each step was then run by hand:

fmt                                             pass
cargo clippy -p horizon-client --all-targets -D warnings   pass
cargo test -p horizon-client --lib --bins --tests          pass (1074 + 99 + 18 + 2 + 2 + 2 + 1, 0 failed)
public tree                                     pass
parity --changed origin/main                    108 of 108 pass (103 in the pr_ready run, then tab_list and world_spawn#1-4)
lan_e2e damage hazards contacts ladder lava mobs hurt      7/7 pass (host in-frame), 7/7 pass (--server-thread)

What needs Ludovic

Nothing. Not in this PR, but seen while working on it:

  • Horizon's server ignores the fall_damage, fire_damage, drowning_damage and freeze_damage game rules for players (Player.isInvulnerableTo). They are stored but never read.
  • On a vanilla server, the client hears no hurt sound of its own, because vanilla plays it from handleDamageEvent. Horizon's own server sends that sound as a sound packet, so playing it from DamageEvent as well would need care to avoid playing it twice.

🤖 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/1648 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/remote-fall-hurt` --- ### 📝 Commits (1) - [`d604409`](https://github.com/horizon-rust/horizon/commit/d604409be256d03a861b94080cba657714d734e7) A client's own fall no longer hurts it: the server's hurt starts the tilt ### 📊 Changes **5 files changed** (+105 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/agent.rs` (+2 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+24 -4) 📝 `crates/horizon-client/src/health.rs` (+19 -0) 📝 `crates/horizon-client/src/hunger.rs` (+3 -0) 📝 `crates/horizon-client/src/motion.rs` (+57 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What On a server that cancels fall damage (lobbies with double jump; vanilla 26.3's `/gamerule fall_damage false` gives the client the same situation), Horizon's screen tilted on landing as if hurt, though health stayed full. Reported on Discord on 2026-10-24. Cause: as a client (`remote`: multiplayer, a LAN guest, single player on its server thread) Horizon still ran its own predicted damage through the local hurt: fall damage (`landing.rs` `FallCall::hurt`), and also fire, lava, freezing, sweet berry bushes, cactus/magma, the void and in-wall damage (`environment_hurt`, `freeze_damage`), plus starvation (`food_tick`). The hurt set `hurt_animation_time`, and `bob_hurt` tilted the camera. `apply_remote_health` then put the health back, but left the tilt running. ## Vanilla 26.3 - `Entity.hurt` only hurts in a `ServerLevel`. `LivingEntity.causeFallDamage` still runs on the client and plays the fall sounds through `LocalPlayer.playSound`, but its `this.hurt(...)` does nothing there. `FoodData.tick` runs from `ServerPlayer.tick` only. - The client's own hurt animation (`hurtTime`/`hurtDuration`, which `GameRenderer.bobHurt` reads) comes from the server in three ways: - `LocalPlayer.hurtTo` (`handleSetHealth`): once `flashOnSetHealth` is set by the first health packet, a drop starts it; - `handleDamageEvent` → `LivingEntity.handleDamageEvent`; - `handleHurtAnimation` → `animateHurt`. The server sends both of these to the hurt player as well (`sendToTrackingPlayersAndSelf`). ## How - `PlayerMotion.client_side`, set in `tick_remote`. While it is set, `hurt_blocking` and `food_tick` do nothing. Landing, fall-distance tracking and the fall sounds work as before. - `remote.rs`: on `SetHealth`, `flash_health_change` follows `hurtTo`. A `DamageEvent` or `HurtAnimation` for the player's own entity id calls `animate_hurt`. Before this change, only mobs handled those two packets. - `horizon-ctl state` now reports the player's `hurt_time`, so the tilt can be checked from outside the game. - Regression test: `motion::tests::a_clients_own_fall_does_not_hurt_it`. A 30-block landing with `client_side` set plays `big_fall` and leaves health and hurt time unchanged. Without the flag the same landing hurts. A health drop sent afterwards starts the hurt animation. ## Evidence The client falls 20 blocks (`tp ~ ~20 ~`), then `horizon-ctl hurtlog` and `state` are polled every 100 ms. | Setup | main | this branch | |---|---|---| | Vanilla 26.3 dedicated server, `fall_damage false` | client hurtlog: `fall 17.0, hurt: true` (local health 3, tilt), server health 20 | hurtlog empty, `hurt_time` stays 0, health 20 | | Vanilla 26.3 server, `fall_damage true` | | `SetHealth` 3 → `hurt_time` 10, 6, 1 (tilt from the server) | | Horizon server thread (default) | | client hurtlog empty, `hurt_time` 10 → 3, health 3 (from the server) | | Horizon `--in-frame` | | the local game is the server: `fall 17, hurt: true`, `hurt_time` 10 | | Horizon dedicated server | | client hurtlog empty, `hurt_time` 9, 5, 1, health 3 | `lan_e2e.py --check damage hazards contacts ladder lava mobs hurt`: all 7 pass with the host in-frame and all 7 pass with `--server-thread`. ## Self-check Run on the Mac mini at bb1ec3fa3; the diff is the same after the rebase onto main (d604409be). `tools/pr_ready.py` was stopped by the session's 2 h limit while it ran the harnesses, so each step was then run by hand: ``` fmt pass cargo clippy -p horizon-client --all-targets -D warnings pass cargo test -p horizon-client --lib --bins --tests pass (1074 + 99 + 18 + 2 + 2 + 2 + 1, 0 failed) public tree pass parity --changed origin/main 108 of 108 pass (103 in the pr_ready run, then tab_list and world_spawn#1-4) lan_e2e damage hazards contacts ladder lava mobs hurt 7/7 pass (host in-frame), 7/7 pass (--server-thread) ``` ## What needs Ludovic Nothing. Not in this PR, but seen while working on it: - Horizon's server ignores the `fall_damage`, `fire_damage`, `drowning_damage` and `freeze_damage` game rules for players (`Player.isInvulnerableTo`). They are stored but never read. - On a vanilla server, the client hears no hurt sound of its own, because vanilla plays it from `handleDamageEvent`. Horizon's own server sends that sound as a sound packet, so playing it from `DamageEvent` as well would need care to avoid playing it twice. 🤖 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:11:13 +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#3658
No description provided.