[PR #6294] [CLOSED] A pig's rider gets off when the pig is submerged #6776

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6294
Author: @MSedgeMC
Created: 11/1/2026
Status: ❌ Closed

Base: main ← Head: fix/gp-pig-underwater


📝 Commits (1)

  • b3bcf7d A pig's rider gets off when the pig is submerged

📊 Changes

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

View changed files

📝 crates/horizon-client/src/game/mounts.rs (+62 -0)

📄 Description

Vanilla makes a rider get off a submerged pig: LivingEntity.baseTick asks the vehicle whether it dismountsUnderwater once the rider's own eyes are in the water, and stops the ride if it does.

205: invokevirtual  isEyeInFluid(FluidTags.WATER):Z
212: ifeq           395      // not underwater: refill the air instead
...
364: invokevirtual  isPassenger():Z
368: ifeq           392
371: invokevirtual  getVehicle():LEntity;
375: ifnull         392
378: invokevirtual  Entity.dismountsUnderwater():Z
385: ifeq           392
388: invokevirtual  stopRiding()

Entity.dismountsUnderwater is this.is(EntityTypeTags.DISMOUNTS_UNDERWATER):

0: getstatic  EntityTypeTags.DISMOUNTS_UNDERWATER
4: invokevirtual  Entity.is(TagKey):Z

and the shipped data/minecraft/tags/entity_type/dismounts_underwater.json lists camel, chicken, donkey, happy_ghast, horse, llama, mule, pig, ravager, spider, strider, trader_llama, zombie_horse.

Horizon's Game::tick_mount_riding (crates/horizon-client/src/game/mounts.rs) only left a mount on sneak or on the mount dying, and the client never read the tag at all, so a player who rode a pig into deep water stayed in the saddle.

The ride tick now samples the rider's eye against the water (isEyeInFluid(WATER) at the seat the player sat in on the previous tick, as the base tick sees it) and asks MobData for the mount's type in minecraft:dismounts_underwater; either the sneak key, the mount's death or that check leaves the mount through the same dismount_mount. Every player exit goes through tick_mount_riding, single player and a LAN guest driving its own mount included.

Proven: cargo test -q -p horizon-client --bin horizon-client the_underwater_dismount_tag -> 1 passed on the build VM: the test loads the shipped entity type tags and checks that the tag the check reads lists the mounts this covers (pig, horse, donkey, mule, camel, strider, llama, ravager, spider) and not a cow. The mount code lives in the client binary, so the test runs there; a second commit on this branch loads the tags through the library (horizon_client::items::load_tags) so it builds in that target.

Not proven: the game itself: saddle a pig, ride it into deep water and the player should be put beside the pig as soon as its eyes go under, once each for a horse, a camel and a strider. The eye sample and the dismount run in Game, which no headless test drives, so that part is verified by reading. The tag test returns early on a checkout without .local/horizon-client/26.3; it ran on the build VM, which has them.

Known limit: a mob riding a mount from that tag (a baby zombie on a chicken) does not get the same check; a mob's base tick reads its vehicle only by id and the tag is not consulted there.


🔄 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/6294 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/gp-pig-underwater` --- ### 📝 Commits (1) - [`b3bcf7d`](https://github.com/horizon-rust/horizon/commit/b3bcf7dc7b3557eda30d617b70c91ed2b6bd097f) A pig's rider gets off when the pig is submerged ### 📊 Changes **1 file changed** (+62 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/mounts.rs` (+62 -0) </details> ### 📄 Description Vanilla makes a rider get off a submerged pig: `LivingEntity.baseTick` asks the vehicle whether it `dismountsUnderwater` once the rider's own eyes are in the water, and stops the ride if it does. ``` 205: invokevirtual isEyeInFluid(FluidTags.WATER):Z 212: ifeq 395 // not underwater: refill the air instead ... 364: invokevirtual isPassenger():Z 368: ifeq 392 371: invokevirtual getVehicle():LEntity; 375: ifnull 392 378: invokevirtual Entity.dismountsUnderwater():Z 385: ifeq 392 388: invokevirtual stopRiding() ``` `Entity.dismountsUnderwater` is `this.is(EntityTypeTags.DISMOUNTS_UNDERWATER)`: ``` 0: getstatic EntityTypeTags.DISMOUNTS_UNDERWATER 4: invokevirtual Entity.is(TagKey):Z ``` and the shipped `data/minecraft/tags/entity_type/dismounts_underwater.json` lists `camel, chicken, donkey, happy_ghast, horse, llama, mule, pig, ravager, spider, strider, trader_llama, zombie_horse`. Horizon's `Game::tick_mount_riding` (`crates/horizon-client/src/game/mounts.rs`) only left a mount on sneak or on the mount dying, and the client never read the tag at all, so a player who rode a pig into deep water stayed in the saddle. The ride tick now samples the rider's eye against the water (`isEyeInFluid(WATER)` at the seat the player sat in on the previous tick, as the base tick sees it) and asks `MobData` for the mount's type in `minecraft:dismounts_underwater`; either the sneak key, the mount's death or that check leaves the mount through the same `dismount_mount`. Every player exit goes through `tick_mount_riding`, single player and a LAN guest driving its own mount included. **Proven:** `cargo test -q -p horizon-client --bin horizon-client the_underwater_dismount_tag` -> 1 passed on the build VM: the test loads the shipped entity type tags and checks that the tag the check reads lists the mounts this covers (pig, horse, donkey, mule, camel, strider, llama, ravager, spider) and not a cow. The mount code lives in the client binary, so the test runs there; a second commit on this branch loads the tags through the library (`horizon_client::items::load_tags`) so it builds in that target. **Not proven:** the game itself: saddle a pig, ride it into deep water and the player should be put beside the pig as soon as its eyes go under, once each for a horse, a camel and a strider. The eye sample and the dismount run in `Game`, which no headless test drives, so that part is verified by reading. The tag test returns early on a checkout without `.local/horizon-client/26.3`; it ran on the build VM, which has them. Known limit: a mob riding a mount from that tag (a baby zombie on a chicken) does not get the same check; a mob's base tick reads its vehicle only by id and the tag is not consulted there. --- <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:25 +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#6776
No description provided.