[GH-ISSUE #180] Falling into water still deals fall damage to the player #50

Closed
opened 2026-11-02 15:35:55 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @ludovic111 on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/180

What happens

A survival player who falls into water still takes fall damage. In vanilla, any water the player lands in cancels the fall.

Repro (seen on the fix/maces-105 build, but the same code is on main):

  1. Stand on a stone floor at y = 96 with a 1-deep water pool on top of it (fill -36 97 -8 -33 97 -6 water).
  2. Teleport to 12 blocks above the pool (tp -34.5 109 -5.7). The player's box sits fully inside the water column (block -35, 97, -6).
  3. Fall into the pool.

Horizon: the player lands at y = 97.0, standing in water, at 11.8/20 HP (about 8 HP lost). Vanilla: no damage.

What vanilla does (26.3, bytecode through tools/rea_vanilla.py)

  • LivingEntity.checkFallDamage(ya, onGround, onState, pos) starts with if (!isInWater()) updateFluidInteraction();, before any fall handling. So the landing move itself notices the water.
  • Entity.updateFluidInteraction(): when the entity is in water, it calls resetFallDistance(), plays the splash effect if it wasn't touching water before, and sets wasTouchingWater.
  • Entity.checkFallDamage then only adds -ya to fallDistance when !isInWater(), and calls fallOn only when fallDistance > 0. The fall is already 0, so the player takes no damage, makes no landing sound and posts no hit_ground.
  • baseTick also resets the fall every tick the entity is in water. But a player who enters and lands in the same tick is only saved by the call inside checkFallDamage.

Why Horizon misses it

The player's movement world treats every fluid as empty:

  • crates/horizon-client/src/landing.rs: FallDamageWorld::is_in_water returns Ok(false), and LivingLandingWorld::update_fluid_interaction is a no-op (// dry scene).
  • crates/horizon-client/src/motion.rs: the in_water / eyes_in_water hooks return Ok(false). fall_reset_clip notes "Every fluid in this controlled scene is empty".
  • Nothing else resets PlayerMotion::fall_distance in water (the resets are for flying, cobwebs, mounts, teleports and maces).

horizon_world::living_landing::check_living_fall_damage and fall_damage::check_fall_damage already follow vanilla's order. Only the player's water state is missing.

Notes for the fix

  • Feed real fluid state to the player's is_in_water / update_fluid_interaction (water at the player's box, as fluidInteraction.update computes it). Reset the fall there, and also in the per-tick base update.
  • The fall-damage harness (tools/test_fall_damage_parity.py) and the living landing harness should gain water cases: landing in 1-deep water, source and flowing water, waterlogged blocks, and bubble columns.
  • Also check the related effects that hinge on updateFluidInteraction: splash sound and particles, wasTouchingWater, and the water current push (0.014).

Found while checking #105 in game. Not fixed in #175.

🤖 Generated with Claude Code

Originally created by @ludovic111 on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/180 ## What happens A survival player who falls into water still takes fall damage. In vanilla, any water the player lands in cancels the fall. Repro (seen on the `fix/maces-105` build, but the same code is on `main`): 1. Stand on a stone floor at y = 96 with a 1-deep water pool on top of it (`fill -36 97 -8 -33 97 -6 water`). 2. Teleport to 12 blocks above the pool (`tp -34.5 109 -5.7`). The player's box sits fully inside the water column (block -35, 97, -6). 3. Fall into the pool. Horizon: the player lands at y = 97.0, standing in water, at 11.8/20 HP (about 8 HP lost). Vanilla: no damage. ## What vanilla does (26.3, bytecode through `tools/rea_vanilla.py`) - `LivingEntity.checkFallDamage(ya, onGround, onState, pos)` starts with `if (!isInWater()) updateFluidInteraction();`, before any fall handling. So the landing move itself notices the water. - `Entity.updateFluidInteraction()`: when the entity is in water, it calls `resetFallDistance()`, plays the splash effect if it wasn't touching water before, and sets `wasTouchingWater`. - `Entity.checkFallDamage` then only adds `-ya` to `fallDistance` when `!isInWater()`, and calls `fallOn` only when `fallDistance > 0`. The fall is already 0, so the player takes no damage, makes no landing sound and posts no `hit_ground`. - `baseTick` also resets the fall every tick the entity is in water. But a player who enters and lands in the same tick is only saved by the call inside `checkFallDamage`. ## Why Horizon misses it The player's movement world treats every fluid as empty: - `crates/horizon-client/src/landing.rs`: `FallDamageWorld::is_in_water` returns `Ok(false)`, and `LivingLandingWorld::update_fluid_interaction` is a no-op (`// dry scene`). - `crates/horizon-client/src/motion.rs`: the `in_water` / `eyes_in_water` hooks return `Ok(false)`. `fall_reset_clip` notes "Every fluid in this controlled scene is empty". - Nothing else resets `PlayerMotion::fall_distance` in water (the resets are for flying, cobwebs, mounts, teleports and maces). `horizon_world::living_landing::check_living_fall_damage` and `fall_damage::check_fall_damage` already follow vanilla's order. Only the player's water state is missing. ## Notes for the fix - Feed real fluid state to the player's `is_in_water` / `update_fluid_interaction` (water at the player's box, as `fluidInteraction.update` computes it). Reset the fall there, and also in the per-tick base update. - The fall-damage harness (`tools/test_fall_damage_parity.py`) and the living landing harness should gain water cases: landing in 1-deep water, source and flowing water, waterlogged blocks, and bubble columns. - Also check the related effects that hinge on `updateFluidInteraction`: splash sound and particles, `wasTouchingWater`, and the water current push (0.014). Found while checking #105 in game. Not fixed in #175. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@Online5277 commented on GitHub (Oct 14, 2026):

Hey claude, this is fixed in #59 just waiting for that to be merged

<!-- gh-comment-id:6176606683 --> @Online5277 commented on GitHub (Oct 14, 2026): Hey claude, this is fixed in #59 just waiting for that to be merged
Author
Owner

@ludovic111 commented on GitHub (Oct 14, 2026):

Claimed by Cosmic on Discord (GitHub: Online5277), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #180).

<!-- gh-comment-id:6177285649 --> @ludovic111 commented on GitHub (Oct 14, 2026): Claimed by `Cosmic` on Discord (GitHub: `Online5277`), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #180). <!-- kira:work -->
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#50
No description provided.