[PR #6319] [MERGED] A ridden horse floats instead of sinking #6794

Closed
opened 2026-11-03 06:26:46 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6319
Author: @MSedgeMC
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/gp-horse-float


📝 Commits (1)

  • 7dda810 A ridden horse floats instead of sinking

📊 Changes

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

View changed files

📝 crates/horizon-client/src/mobs/living.rs (+130 -0)

📄 Description

Vanilla lifts a mount that carries a rider out of deep water: LivingEntity.travelInFluid ends with floatInLiquidWhileRidden(FluidTags.ENTITY_FLOATABLE).

29: invokevirtual  isInWater():Z
33: ifeq           48
36-42:           travelInWater(input, gravity, falling, y)
48-54:           travelInLava(...)
57: getstatic      FluidTags.ENTITY_FLOATABLE
61: invokevirtual  LivingEntity.floatInLiquidWhileRidden(TagKey)

and that method is

 0: invokevirtual  isVehicle():Z
 4: ifeq           45
 7: getstatic      EntityTypeTags.CAN_FLOAT_WHILE_RIDDEN
11: invokevirtual  Entity.is(TagKey):Z
14: ifeq           45
17-26:           getFluidJumpThreshold() / isInFluidDeeperThan(threshold, fluid)
29-42:           setDeltaMovement(getDeltaMovement().add(0.0, 0.03999999910593033, 0.0))

data/minecraft/tags/entity_type/can_float_while_ridden.json holds horse, zombie_horse, mule, donkey, camel, camel_husk, and minecraft:entity_floatable is #minecraft:water.

Horizon's Mob::travel_in_fluid (crates/horizon-client/src/mobs/living.rs) ported the water and lava branches and jumpOutOfFluid but never made that last call, so a mounted horse only had the water's 0.8 vertical damping and gravity/16: it sank slowly with the player on it instead of holding at the surface. The player-side trip does exist (horizon_world::living_fluid::float_in_liquid_while_ridden), which is why the rider's own fluid travel looked right while the mount did not.

The mob's fluid travel now ends with the same check: a passenger (self.rider or a mob rider), the mount's type in minecraft:can_float_while_ridden, and a water height above getFluidJumpThreshold add 0.04 to the vertical velocity.

Proven: cargo test -q -p horizon-client --lib mobs::living -> 2 passed on the build VM. The new test drops an empty horse and a ridden one into water at the same spot and compares their vertical velocity after one travel: the ridden one is exactly 0.04 (as f32) above the empty one. Without the change the same test fails with a ridden horse gains 0.04 a tick, got 0, so it does exercise the new term.

Not proven: the game itself: ride a horse into deep water and it should stay at the surface with the player on it and swim across; the same for a donkey, a mule and a camel, while a pig and a strider (not in the tag) still sink. The test returns early on a checkout without .local/horizon-client/26.3; it ran on the build VM, which has them.

Known limit: isVehicle is read as "a player rider, or a mob rider on this mount" from the mob's own fields, not from the level's passenger list, which mob-on-mob riding keeps outside the mob.


🔄 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/6319 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/gp-horse-float` --- ### 📝 Commits (1) - [`7dda810`](https://github.com/horizon-rust/horizon/commit/7dda810ac9342780fee6059d5d83cd788284fcdd) A ridden horse floats instead of sinking ### 📊 Changes **1 file changed** (+130 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/living.rs` (+130 -0) </details> ### 📄 Description Vanilla lifts a mount that carries a rider out of deep water: `LivingEntity.travelInFluid` ends with `floatInLiquidWhileRidden(FluidTags.ENTITY_FLOATABLE)`. ``` 29: invokevirtual isInWater():Z 33: ifeq 48 36-42: travelInWater(input, gravity, falling, y) 48-54: travelInLava(...) 57: getstatic FluidTags.ENTITY_FLOATABLE 61: invokevirtual LivingEntity.floatInLiquidWhileRidden(TagKey) ``` and that method is ``` 0: invokevirtual isVehicle():Z 4: ifeq 45 7: getstatic EntityTypeTags.CAN_FLOAT_WHILE_RIDDEN 11: invokevirtual Entity.is(TagKey):Z 14: ifeq 45 17-26: getFluidJumpThreshold() / isInFluidDeeperThan(threshold, fluid) 29-42: setDeltaMovement(getDeltaMovement().add(0.0, 0.03999999910593033, 0.0)) ``` `data/minecraft/tags/entity_type/can_float_while_ridden.json` holds `horse, zombie_horse, mule, donkey, camel, camel_husk`, and `minecraft:entity_floatable` is `#minecraft:water`. Horizon's `Mob::travel_in_fluid` (`crates/horizon-client/src/mobs/living.rs`) ported the water and lava branches and `jumpOutOfFluid` but never made that last call, so a mounted horse only had the water's 0.8 vertical damping and gravity/16: it sank slowly with the player on it instead of holding at the surface. The player-side trip does exist (`horizon_world::living_fluid::float_in_liquid_while_ridden`), which is why the rider's own fluid travel looked right while the mount did not. The mob's fluid travel now ends with the same check: a passenger (`self.rider` or a mob rider), the mount's type in `minecraft:can_float_while_ridden`, and a water height above `getFluidJumpThreshold` add `0.04` to the vertical velocity. **Proven:** `cargo test -q -p horizon-client --lib mobs::living` -> 2 passed on the build VM. The new test drops an empty horse and a ridden one into water at the same spot and compares their vertical velocity after one `travel`: the ridden one is exactly `0.04` (as f32) above the empty one. Without the change the same test fails with `a ridden horse gains 0.04 a tick, got 0`, so it does exercise the new term. **Not proven:** the game itself: ride a horse into deep water and it should stay at the surface with the player on it and swim across; the same for a donkey, a mule and a camel, while a pig and a strider (not in the tag) still sink. The test returns early on a checkout without `.local/horizon-client/26.3`; it ran on the build VM, which has them. Known limit: `isVehicle` is read as "a player rider, or a mob rider on this mount" from the mob's own fields, not from the level's passenger list, which mob-on-mob riding keeps outside the mob. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:26:46 +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#6794
No description provided.