[PR #6717] [MERGED] Pin the fluid current's push rules #7050

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

📋 Pull Request Information

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

Base: main ← Head: test/fluid-current-rules


📝 Commits (2)

  • c85564e Pin the fluid current's push rules
  • 81569ba Merge remote-tracking branch 'upstream/main' into fluid

📊 Changes

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

View changed files

📝 crates/horizon-world/src/entity_fluid.rs (+117 -0)

📄 Description

EntityFluidInteraction$CurrentAccumulator.applyTo has three rules that nothing pinned:

// javap -p -c on EntityFluidInteraction$CurrentAccumulator
22-26: entity instanceof Player
29-38: not a player -> accumulated.normalize()
41-55: a player     -> accumulated.scale(1.0 / currentCount)
63-69: scale by the fluid's speed
76-129: if |delta.x| < 0.003 && |delta.z| < 0.003 && flow.length() < 0.0045
        -> flow = flow.normalize().scale(0.0045)
131-134: entity.addDeltaMovement(flow)

Horizon's entity_fluid.rs implements all of it, and crates/horizon-world had no test for
this file at all - the only coverage was through an item in horizon-client-lib, which cannot
see the player/non-player split.

Three cases now pin it: a mob pushed by two samples of (1,0,0) moves as far as by one (the
direction), a player gets the average, a 0.1 sample on a still body is lifted to 0.0045 while
the same sample on a body already moving on x stays at 0.0014, and no samples or a current
under the 1e-5 threshold add nothing.

Proven: on the build VM, cargo test -q -p horizon-world --lib entity_fluid -> 3 passed,
rustfmt --edition 2024 --check clean. The weak-current case first failed at 0.007 because my
sample was too strong to be lifted - the code was right and the case was wrong, which is what
the assertion is for.

Not proven: no in-game check; this adds no behaviour, it pins behaviour that already
matched the 26.3 jar.


🔄 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/6717 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `test/fluid-current-rules` --- ### 📝 Commits (2) - [`c85564e`](https://github.com/horizon-rust/horizon/commit/c85564e2623ad7d2d98b7ccd8eef0ca8117141c0) Pin the fluid current's push rules - [`81569ba`](https://github.com/horizon-rust/horizon/commit/81569ba550eabe0572116d43c685169f4bd2903e) Merge remote-tracking branch 'upstream/main' into fluid ### 📊 Changes **1 file changed** (+117 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/entity_fluid.rs` (+117 -0) </details> ### 📄 Description `EntityFluidInteraction$CurrentAccumulator.applyTo` has three rules that nothing pinned: ```java // javap -p -c on EntityFluidInteraction$CurrentAccumulator 22-26: entity instanceof Player 29-38: not a player -> accumulated.normalize() 41-55: a player -> accumulated.scale(1.0 / currentCount) 63-69: scale by the fluid's speed 76-129: if |delta.x| < 0.003 && |delta.z| < 0.003 && flow.length() < 0.0045 -> flow = flow.normalize().scale(0.0045) 131-134: entity.addDeltaMovement(flow) ``` Horizon's `entity_fluid.rs` implements all of it, and `crates/horizon-world` had no test for this file at all - the only coverage was through an item in `horizon-client-lib`, which cannot see the player/non-player split. Three cases now pin it: a mob pushed by two samples of (1,0,0) moves as far as by one (the direction), a player gets the average, a 0.1 sample on a still body is lifted to 0.0045 while the same sample on a body already moving on x stays at 0.0014, and no samples or a current under the 1e-5 threshold add nothing. **Proven:** on the build VM, `cargo test -q -p horizon-world --lib entity_fluid` -> `3 passed`, `rustfmt --edition 2024 --check` clean. The weak-current case first failed at 0.007 because my sample was too strong to be lifted - the code was right and the case was wrong, which is what the assertion is for. **Not proven:** no in-game check; this adds no behaviour, it pins behaviour that already matched the 26.3 jar. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:32: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#7050
No description provided.