[PR #1597] [MERGED] Fish: the window tracks the fluid contact of the mobs it only displays #3621

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

📋 Pull Request Information

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

Base: main ← Head: fix/remote-mob-fluid-contact


📝 Commits (2)

  • 508cb2d Fish: the window tracks the fluid contact of the mobs it only displays
  • 6c6c08f Fluid contact on a client: only for the entities that tick

📊 Changes

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

View changed files

📝 crates/horizon-client/src/game/remote.rs (+20 -0)

📄 Description

🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself.

Fixes #1591.

What and why

In water, cod, salmon and tropical fish were drawn rolled onto their side. Heading and position were fine, they just lay on their flank.

The rotation is not wrong in itself: mobs/aquatic.rs turns a fish onto its side only while it is out of water, which is what vanilla does.

if !m.fluids.in_water {
    ...
    t *= glam::Mat4::from_translation(off) * glam::Mat4::from_rotation_z(PI / 2.0);
}

m.fluids is filled by Mob::update_fluids, and that is called from the mob tick in mobs/ai.rs which only the server runs. A window that is a client of a server (singleplayer on its server thread, a LAN guest, multiplayer) never runs it and nothing else in remote*.rs assigns the field, so every displayed mob kept the default in_water: false and every fish took the out-of-water branch.

The fix runs the same update the server runs (EntityFluidInteraction.update, MobWorld::fluids over the deflated box and the eye column) for the mobs this window displays, once per tick in tick_remote_entities, before their animations. The server stays authoritative; this only gives the renderer the water contact it reads, matching what a client-side Entity.tick does in vanilla for entities it does not simulate.

The fluid contact is computed with mob_world_base(&[]): the collisions between mobs are not part of this query, so an empty others list is the same result the server gets, without building the neighbour grid the AI needs.

Vanilla reference

Entity.updateFluidHeightAndDoFluidPushing (and getFluidHeight) fill the per-entity fluidHeight/wasTouchingWater state that isInWater() reports, and every entity runs it in Entity.baseTick on each side. The rotation that reads it is the fish branch of EntityRenderDispatcher/LivingEntityRenderer's setup for the fish renderer (setupRotations turning the model onto its flank for a fish out of water).

Self-check

The pr_ready block goes into a comment below when that run finishes.

This one deserves an in-game check rather than a harness: the harnesses drive commands, and this is a client render path. cargo check -p horizon-client and rustfmt pass; the fish case is a screenshot in a water tank before and after, which I will add to this PR as soon as I can run a build of the branch (the launcher's MCP drives a released build, not this one).

🤖 Generated with Hermes Agent (Nous Research)


🔄 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/1597 **Author:** [@Domanffe](https://github.com/Domanffe) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/remote-mob-fluid-contact` --- ### 📝 Commits (2) - [`508cb2d`](https://github.com/horizon-rust/horizon/commit/508cb2df9fcd98ea3ca1189f58b8c5fbf888aea7) Fish: the window tracks the fluid contact of the mobs it only displays - [`6c6c08f`](https://github.com/horizon-rust/horizon/commit/6c6c08f4d9ef42e65b5ed9e4a75fcb022fafa65a) Fluid contact on a client: only for the entities that tick ### 📊 Changes **1 file changed** (+20 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+20 -0) </details> ### 📄 Description > 🤖 Opened by Alexander's AI agent (Hermes), not by Alexander himself. Fixes #1591. ## What and why In water, cod, salmon and tropical fish were drawn rolled onto their side. Heading and position were fine, they just lay on their flank. The rotation is not wrong in itself: `mobs/aquatic.rs` turns a fish onto its side only while it is out of water, which is what vanilla does. ```rust if !m.fluids.in_water { ... t *= glam::Mat4::from_translation(off) * glam::Mat4::from_rotation_z(PI / 2.0); } ``` `m.fluids` is filled by `Mob::update_fluids`, and that is called from the mob tick in `mobs/ai.rs` which only the server runs. A window that is a client of a server (singleplayer on its server thread, a LAN guest, multiplayer) never runs it and nothing else in `remote*.rs` assigns the field, so every displayed mob kept the default `in_water: false` and every fish took the out-of-water branch. The fix runs the same update the server runs (`EntityFluidInteraction.update`, `MobWorld::fluids` over the deflated box and the eye column) for the mobs this window displays, once per tick in `tick_remote_entities`, before their animations. The server stays authoritative; this only gives the renderer the water contact it reads, matching what a client-side `Entity.tick` does in vanilla for entities it does not simulate. The fluid contact is computed with `mob_world_base(&[])`: the collisions between mobs are not part of this query, so an empty `others` list is the same result the server gets, without building the neighbour grid the AI needs. ## Vanilla reference `Entity.updateFluidHeightAndDoFluidPushing` (and `getFluidHeight`) fill the per-entity `fluidHeight`/`wasTouchingWater` state that `isInWater()` reports, and every entity runs it in `Entity.baseTick` on each side. The rotation that reads it is the fish branch of `EntityRenderDispatcher`/`LivingEntityRenderer`'s setup for the fish renderer (`setupRotations` turning the model onto its flank for a fish out of water). ## Self-check The `pr_ready` block goes into a comment below when that run finishes. This one deserves an in-game check rather than a harness: the harnesses drive commands, and this is a client render path. `cargo check -p horizon-client` and `rustfmt` pass; the fish case is a screenshot in a water tank before and after, which I will add to this PR as soon as I can run a build of the branch (the launcher's MCP drives a released build, not this one). 🤖 Generated with Hermes Agent (Nous Research) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:10:52 +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#3621
No description provided.