[PR #186] [MERGED] Water cancels the player's fall damage (#180) #2386

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

📋 Pull Request Information

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

Base: main ← Head: fix/water-fall-damage-180


📝 Commits (3)

  • 60d9bff Water cancels the player's fall damage (#180)
  • f442374 Format the player fluid binding
  • 645109d Keep the scene motion scope text a valid string

📊 Changes

7 files changed (+588 additions, -24 deletions)

View changed files

📝 crates/horizon-client/examples/scene_motion_probe.rs (+37 -3)
📝 crates/horizon-client/src/game.rs (+31 -0)
📝 crates/horizon-client/src/landing.rs (+3 -3)
📝 crates/horizon-client/src/motion.rs (+36 -6)
➕ crates/horizon-client/src/motion/fluids.rs (+334 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSceneMotionOracle.java (+29 -11)
📝 tools/test_native_scene_motion.py (+118 -1)

📄 Description

Fixes #180

Root cause

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

  • landing.rs: FallDamageWorld::is_in_water was always false and LivingLandingWorld::update_fluid_interaction was a no-op, so LivingEntity.checkFallDamage's if (!isInWater()) updateFluidInteraction() never saw the water the landing move ended in.
  • motion.rs: fall_reset_clip (Entity.move's ClipContext(FALLDAMAGE_RESETTING, Fluid.WATER) ray for falls of a block per tick or more) ignored water.
  • Nothing ran Entity.baseTick's updateFluidInteraction for the player, so standing in water never reset the fall either.

Fix

crates/horizon-client/src/motion/fluids.rs binds vanilla's Entity.updateFluidInteraction to the player over the existing, parity-tested horizon-world kernels (EntityFluidInteraction heights/eyes/currents, entity_fluid_tick, water_splash, fluid_flow, fluid_shape):

  • the base-tick fluid phase (wasEyeInWater, updateFluidInteraction, lava's fallDistance *= 0.5 after the first tick, firstTick) runs at the start of every player tick;
  • checkFallDamage refreshes the fluids when not already in water, and isInWater reads wasTouchingWater;
  • the fall-reset ray queries the water's shape (with the first-query FlowingFluid.shapes cache, process-wide like the JVM's);
  • touching water resets the fall, plays entity.player.splash / splash.high_speed with BUBBLE and SPLASH particles, and water/lava currents push the player (Player.isPushedByFluid: not while flying; Nether FAST_LAVA).
    Water includes flowing/falling water, waterlogged blocks, bubble columns, kelp and seagrass (FluidState::from_block); lava resets nothing.

Mobs already refresh their fluids in their own landing (mobs/living.rs); items take no fall damage.

Parity proof

tools/test_native_scene_motion.py gains water_corpus(): falls of every height into 1-3 deep source/flowing/falling water, preset teleport falls (the #180 repro), waterlogged slabs/stairs/fences/trapdoors/lanterns/roots/ladders/grates/bars (water above or below the feet), bubble columns, kelp, seagrass, lava pools, water under lava, fast falls through hanging water layers (the ray), flying players, currents over random flowing water, eyes under water, splashes at several scales, and bare checkFallDamage landings. A new fluid_tick op runs the base-tick fluid phase; falls go through the real Entity.move. The oracle now runs the real updateFluidInteraction/isInWater/isEyeInFluid/getFluidHeight with vanilla's #water/#lava tags bound (it used to stub them dry); snapshots add wasTouchingWater, wasEyeInWater, eyes, firstTick and both fluid heights, events add the splash sound, particles and game event.

Mac mini (~/fleet/rbuild macmini):

  • test_native_scene_motion.py: 2,499,038 / 2,499,038 lines per side (client and server jars; was 2,210,051 before the water corpus). Water fixtures produce 116 splashes (15 high-speed), 1,517 bubble particles, 12,833 in-water states, 3,725 eyes-under-water states and lava halving.
  • test_native_scene_motion.py --sprint-input: 334,930 / 334,930.
  • test_auto_jump_parity.py: 10,568 cases match.
  • cargo clippy --workspace --all-targets --locked -D warnings: clean; cargo test -p horizon-client --lib: 439 passed.

Note on #59

#59 (Online5277) adds player swimming/drowning and its own fluid binding, but leaves landing.rs dry (a player entering and landing in water in the same tick, the #180 repro, still takes damage there) and deflates the fluid box by 1e-5 where vanilla uses 0.001. The two will conflict in motion.rs; #59 can build its swimming on PlayerMotion::fluids / MotionWorld::update_fluids from this PR.

In-game check

(see the comment below)

🤖 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/186 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/water-fall-damage-180` --- ### 📝 Commits (3) - [`60d9bff`](https://github.com/horizon-rust/horizon/commit/60d9bffc8682c8d4ebe12471b1de17c430db86ec) Water cancels the player's fall damage (#180) - [`f442374`](https://github.com/horizon-rust/horizon/commit/f442374e6da1e6164f3fee62fea3a6533f1bbd51) Format the player fluid binding - [`645109d`](https://github.com/horizon-rust/horizon/commit/645109d427fea81f90e8dfe437f57e7bfda19a42) Keep the scene motion scope text a valid string ### 📊 Changes **7 files changed** (+588 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/scene_motion_probe.rs` (+37 -3) 📝 `crates/horizon-client/src/game.rs` (+31 -0) 📝 `crates/horizon-client/src/landing.rs` (+3 -3) 📝 `crates/horizon-client/src/motion.rs` (+36 -6) ➕ `crates/horizon-client/src/motion/fluids.rs` (+334 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaSceneMotionOracle.java` (+29 -11) 📝 `tools/test_native_scene_motion.py` (+118 -1) </details> ### 📄 Description Fixes #180 ## Root cause The player's movement world treated every fluid as empty: - `landing.rs`: `FallDamageWorld::is_in_water` was always `false` and `LivingLandingWorld::update_fluid_interaction` was a no-op, so `LivingEntity.checkFallDamage`'s `if (!isInWater()) updateFluidInteraction()` never saw the water the landing move ended in. - `motion.rs`: `fall_reset_clip` (Entity.move's `ClipContext(FALLDAMAGE_RESETTING, Fluid.WATER)` ray for falls of a block per tick or more) ignored water. - Nothing ran `Entity.baseTick`'s `updateFluidInteraction` for the player, so standing in water never reset the fall either. ## Fix `crates/horizon-client/src/motion/fluids.rs` binds vanilla's `Entity.updateFluidInteraction` to the player over the existing, parity-tested horizon-world kernels (`EntityFluidInteraction` heights/eyes/currents, `entity_fluid_tick`, `water_splash`, `fluid_flow`, `fluid_shape`): - the base-tick fluid phase (`wasEyeInWater`, `updateFluidInteraction`, lava's `fallDistance *= 0.5` after the first tick, `firstTick`) runs at the start of every player tick; - `checkFallDamage` refreshes the fluids when not already in water, and `isInWater` reads `wasTouchingWater`; - the fall-reset ray queries the water's shape (with the first-query `FlowingFluid.shapes` cache, process-wide like the JVM's); - touching water resets the fall, plays `entity.player.splash` / `splash.high_speed` with BUBBLE and SPLASH particles, and water/lava currents push the player (`Player.isPushedByFluid`: not while flying; Nether `FAST_LAVA`). Water includes flowing/falling water, waterlogged blocks, bubble columns, kelp and seagrass (`FluidState::from_block`); lava resets nothing. Mobs already refresh their fluids in their own landing (`mobs/living.rs`); items take no fall damage. ## Parity proof `tools/test_native_scene_motion.py` gains `water_corpus()`: falls of every height into 1-3 deep source/flowing/falling water, preset teleport falls (the #180 repro), waterlogged slabs/stairs/fences/trapdoors/lanterns/roots/ladders/grates/bars (water above or below the feet), bubble columns, kelp, seagrass, lava pools, water under lava, fast falls through hanging water layers (the ray), flying players, currents over random flowing water, eyes under water, splashes at several scales, and bare `checkFallDamage` landings. A new `fluid_tick` op runs the base-tick fluid phase; falls go through the real `Entity.move`. The oracle now runs the real `updateFluidInteraction`/`isInWater`/`isEyeInFluid`/`getFluidHeight` with vanilla's `#water`/`#lava` tags bound (it used to stub them dry); snapshots add `wasTouchingWater`, `wasEyeInWater`, eyes, `firstTick` and both fluid heights, events add the splash sound, particles and game event. Mac mini (`~/fleet/rbuild macmini`): - `test_native_scene_motion.py`: **2,499,038 / 2,499,038** lines per side (client and server jars; was 2,210,051 before the water corpus). Water fixtures produce 116 splashes (15 high-speed), 1,517 bubble particles, 12,833 in-water states, 3,725 eyes-under-water states and lava halving. - `test_native_scene_motion.py --sprint-input`: 334,930 / 334,930. - `test_auto_jump_parity.py`: 10,568 cases match. - `cargo clippy --workspace --all-targets --locked -D warnings`: clean; `cargo test -p horizon-client --lib`: 439 passed. ## Note on #59 #59 (Online5277) adds player swimming/drowning and its own fluid binding, but leaves `landing.rs` dry (a player entering and landing in water in the same tick, the #180 repro, still takes damage there) and deflates the fluid box by 1e-5 where vanilla uses 0.001. The two will conflict in `motion.rs`; #59 can build its swimming on `PlayerMotion::fluids` / `MotionWorld::update_fluids` from this PR. ## In-game check (see the comment below) 🤖 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-02 15:55:33 +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#2386
No description provided.