[PR #5203] [MERGED] Native mods: move a block's fluids to another block (API next) #6139

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

📋 Pull Request Information

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

Base: main ← Head: hooks-fluid-move


📝 Commits (8)

  • c5f62fe Native mods: a block's fluids, read, filled and drained in millibuckets
  • 962288e Fluids: a cauldron never exceeds the ask, a shrunk tank table keeps its tanks, no overflow
  • b3e0f1d Merge main; the fluid hooks as an API fragment
  • b3c3bc2 Merge remote-tracking branch 'hr/main' into qw-5188
  • a5fcdd7 Native mods: move a block's fluids to another block
  • d346e90 Merge main (#5130's item handler beside the fluid handler)
  • 9314523 Fluid tanks: clamp a bad capacity instead of renumbering the tanks
  • 5b56e48 Keep #5188's head and the move's fixes over the rebase

📊 Changes

10 files changed (+779 additions, -5 deletions)

View changed files

📝 crates/horizon-client-render/src/block_entities.rs (+11 -1)
📝 crates/horizon-client-render/src/chunk/block_entity.rs (+15 -0)
📝 crates/horizon-client-render/src/containers.rs (+1 -1)
📝 crates/horizon-client/src/game/block_entity_ticks.rs (+2 -0)
📝 crates/horizon-client/src/game/machines.rs (+1 -0)
➕ crates/horizon-client/src/game/machines/native_fluids.rs (+673 -0)
📝 crates/horizon-client/src/game/machines/native_items.rs (+3 -2)
📝 crates/horizon-client/src/game/native_hooks.rs (+52 -1)
➕ tools/native-hook-fragments/fluids.json (+13 -0)
➕ tools/native-hook-fragments/fluids_move.json (+8 -0)

📄 Description

🤖 Opened by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally.

What and why

Fixes #5194. Part of #3911 (Mods), of #4953's capabilities and of the fluid handler claim (#5134, #5188). Stacked on #5188 — review only the last commit (931452302 plus the maintainer merges; the PR's own changes are what the reviews cover; on top of #5188's review-fix commit). Its number is asked for with tools/native-hook-fragments/fluids_move.json (helper-only, empty hooks), as #5161 directs, in levzzz's fluids naming; a local stamp dry run gives it the number after #5188's.

The fluid handler (#5188) reads, fills and drains — but moving between two blocks was the mod's own drain-into-hands, insert, put-the-rest-back. With a cauldron in the chain that's easy to get wrong: a drain hands out whole thirds of a bucket (asking 400 gives 666), so a careless drain-then-refused-insert loses a third.

  • native_move_fluids(dimension, from, from_face, to, to_face, max) — up to max millibuckets between two blocks, one fluid (whatever the source's side gives first), native_move_items's shape. What the target won't take goes back into the source, past the fill sides' leave: the drain keeps a receipt of what left which tank, and those tanks just gave it up, so they have room for exactly that; a cauldron levels back up by the thirds it gave. The fluid and how much moved; none where native_fluid_tanks is none at the source, where nothing drainable is, where the target holds no fluids, and within one block.

native_fluid_extract's drain now runs through the same receipt-taking path (fluid_take); its answer is unchanged.

Kind

  • feature: something new for players (listed under New in the release notes)
  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Horizon-only helper, NeoForge's IFluidHandler fill-and-drain convention (#4953's capabilities item), with HopperBlockEntity's refused-item-goes-back rule carried to fluids.

Other projects' code

none

Tests

Unit: the receipt's room is what left its tanks — a receipt never names more than its tanks held, and returning it restores exactly what was there.

Live, on this branch (the branch's current head, after the maintainer merges of main, #5188's proof with its review fixes plus the move section): a throwaway mixin bundle on a dedicated server with two horizon-ctl --offscreen clients; RESULT: 37 checks, 0 failures. The move checks: a target that can't take a level moves nothing and the source keeps its fluid; a move tops a cauldron one level and keeps the rest (moved 333, the tank keeps 67); a full tank refuses and the cauldron keeps its thirds (asked 100, one third out and back, nothing moved or lost); a cauldron drains its whole thirds into a tank (666); and a move within one block gives none. The rest of #5188's run (tanks by face, capacity, mixing refused, cauldron thirds, the tick-driven pipe, the client copy, the restart) passes unchanged, with the restart now finding the moved-to tank at 733.

Self-check

pr_ready (tools/pr_ready.py --quick on DESKTOP-H7P5E7K, against origin/main at bd541458c, 1 min 56 s; with HORIZON_NO_AUDIO=1, see #5188's note on the test-audio flake)

Check Result
Scope ⚠️ 9 files, +662 −4; 658 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (1 min 3 s)
rustfmt ✅ (8 s)
clippy ✅ (8 s)
tests: horizon-client, horizon-client-render ✅ 2045 passed (32 s)
doc tests ✅ 0 passed (2 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with ZCode (GLM-5.3)


🔄 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/5203 **Author:** [@Qwerner88880](https://github.com/Qwerner88880) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `hooks-fluid-move` --- ### 📝 Commits (8) - [`c5f62fe`](https://github.com/horizon-rust/horizon/commit/c5f62fe73c50763cce0d5b17325b866bbb1ad2cc) Native mods: a block's fluids, read, filled and drained in millibuckets - [`962288e`](https://github.com/horizon-rust/horizon/commit/962288e85fe8eb3d895a99e2f07f0b98d1863b1c) Fluids: a cauldron never exceeds the ask, a shrunk tank table keeps its tanks, no overflow - [`b3e0f1d`](https://github.com/horizon-rust/horizon/commit/b3e0f1d476720dcc5db433772fb4547e7d01e976) Merge main; the fluid hooks as an API fragment - [`b3c3bc2`](https://github.com/horizon-rust/horizon/commit/b3c3bc2843de3f2461d8e55ba37a98135319d1f5) Merge remote-tracking branch 'hr/main' into qw-5188 - [`a5fcdd7`](https://github.com/horizon-rust/horizon/commit/a5fcdd7f7c96dcd16cdbf8950d0000be45e55c10) Native mods: move a block's fluids to another block - [`d346e90`](https://github.com/horizon-rust/horizon/commit/d346e90232072b6baf75644164e929d853b4fc0c) Merge main (#5130's item handler beside the fluid handler) - [`9314523`](https://github.com/horizon-rust/horizon/commit/9314523024bf6753d653f163d50411aeb32b0215) Fluid tanks: clamp a bad capacity instead of renumbering the tanks - [`5b56e48`](https://github.com/horizon-rust/horizon/commit/5b56e48f99c9f2b1ac6110098ec9ff46641aafec) Keep #5188's head and the move's fixes over the rebase ### 📊 Changes **10 files changed** (+779 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/block_entities.rs` (+11 -1) 📝 `crates/horizon-client-render/src/chunk/block_entity.rs` (+15 -0) 📝 `crates/horizon-client-render/src/containers.rs` (+1 -1) 📝 `crates/horizon-client/src/game/block_entity_ticks.rs` (+2 -0) 📝 `crates/horizon-client/src/game/machines.rs` (+1 -0) ➕ `crates/horizon-client/src/game/machines/native_fluids.rs` (+673 -0) 📝 `crates/horizon-client/src/game/machines/native_items.rs` (+3 -2) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+52 -1) ➕ `tools/native-hook-fragments/fluids.json` (+13 -0) ➕ `tools/native-hook-fragments/fluids_move.json` (+8 -0) </details> ### 📄 Description > 🤖 Opened by Qwerner88880's AI agent (ZCode, GLM-5.3), not by Qwerner88880 personally. ## What and why Fixes #5194. Part of #3911 (Mods), of #4953's capabilities and of the fluid handler claim (#5134, #5188). **Stacked on #5188 — review only the last commit** (`931452302` plus the maintainer merges; the PR's own changes are what the reviews cover; on top of #5188's review-fix commit). Its number is asked for with `tools/native-hook-fragments/fluids_move.json` (helper-only, empty `hooks`), as #5161 directs, in levzzz's `fluids` naming; a local stamp dry run gives it the number after #5188's. The fluid handler (#5188) reads, fills and drains — but moving between two blocks was the mod's own drain-into-hands, insert, put-the-rest-back. With a cauldron in the chain that's easy to get wrong: a drain hands out whole thirds of a bucket (asking 400 gives 666), so a careless drain-then-refused-insert loses a third. - **`native_move_fluids(dimension, from, from_face, to, to_face, max)`** — up to `max` millibuckets between two blocks, one fluid (whatever the source's side gives first), `native_move_items`'s shape. What the target won't take goes **back into the source, past the fill sides' leave**: the drain keeps a receipt of what left which tank, and those tanks just gave it up, so they have room for exactly that; a cauldron levels back up by the thirds it gave. The fluid and how much moved; none where `native_fluid_tanks` is none at the source, where nothing drainable is, where the target holds no fluids, and within one block. `native_fluid_extract`'s drain now runs through the same receipt-taking path (`fluid_take`); its answer is unchanged. ## Kind - [x] feature: something new for players (listed under New in the release notes) - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Horizon-only helper, NeoForge's `IFluidHandler` fill-and-drain convention (#4953's capabilities item), with `HopperBlockEntity`'s refused-item-goes-back rule carried to fluids. ## Other projects' code none ## Tests **Unit:** the receipt's room is what left its tanks — a receipt never names more than its tanks held, and returning it restores exactly what was there. **Live, on this branch (the branch's current head, after the maintainer merges of main, #5188's proof with its review fixes plus the move section):** a throwaway mixin bundle on a dedicated server with two `horizon-ctl --offscreen` clients; RESULT: 37 checks, 0 failures. The move checks: a target that can't take a level moves nothing and the source keeps its fluid; a move tops a cauldron one level and keeps the rest (moved 333, the tank keeps 67); **a full tank refuses and the cauldron keeps its thirds** (asked 100, one third out and back, nothing moved or lost); a cauldron drains its whole thirds into a tank (666); and a move within one block gives none. The rest of #5188's run (tanks by face, capacity, mixing refused, cauldron thirds, the tick-driven pipe, the client copy, the restart) passes unchanged, with the restart now finding the moved-to tank at 733. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on DESKTOP-H7P5E7K, against origin/main at bd541458c, 1 min 56 s; with `HORIZON_NO_AUDIO=1`, see #5188's note on the test-audio flake) | Check | Result | | --- | --- | | Scope | ⚠️ 9 files, +662 −4; 658 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (1 min 3 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (8 s) | | tests: horizon-client, horizon-client-render | ✅ 2045 passed (32 s) | | doc tests | ✅ 0 passed (2 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with ZCode (GLM-5.3) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:14:17 +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#6139
No description provided.