[PR #754] [MERGED] Motion: build the fluid tables from the game's block facts #2783

Closed
opened 2026-11-02 15:59:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/754
Author: @ludovic111
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/18/2026
Merged by: @ludovic111

Base: main ← Head: perf/fluid-facts-once


📝 Commits (2)

  • 2e531f3 Per-state tables: check state identities while reading, never as a tree
  • 580c2b1 Motion: reuse the game's block facts for the fluid tables

📊 Changes

16 files changed (+440 additions, -129 deletions)

View changed files

📝 crates/horizon-client/examples/resource_memory.rs (+1 -15)
📝 crates/horizon-client/src/collisions.rs (+4 -10)
📝 crates/horizon-client/src/game.rs (+1 -1)
📝 crates/horizon-client/src/light.rs (+3 -11)
📝 crates/horizon-client/src/models.rs (+3 -5)
📝 crates/horizon-client/src/motion.rs (+19 -10)
📝 crates/horizon-client/src/motion/fluids.rs (+1 -2)
📝 crates/horizon-world/src/block_properties.rs (+18 -17)
📝 crates/horizon-world/src/block_support.rs (+12 -4)
📝 crates/horizon-world/src/collision.rs (+6 -13)
📝 crates/horizon-world/src/level/data.rs (+3 -10)
📝 crates/horizon-world/src/movement_properties.rs (+5 -13)
📝 crates/horizon-world/src/nbt.rs (+164 -3)
📝 crates/horizon-world/src/registry.rs (+117 -0)
📝 crates/horizon-world/src/worldgen/generator_blocks.rs (+11 -15)
📝 crates/horizon-world/tests/collision_data.rs (+72 -0)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Stacked on #753: review the last commit (580c2b1d). Once #753 merges, this diff drops to that commit.

What

MotionResources::load built the fluid tables from FluidResources::load, and that call decoded gameplay-facts.json again. The game had already decoded the same file into BlockFacts one step earlier. With ATM10's carried mods, that file is 211 MB of JSON, so the second decode built a few hundred MB of serde_json::Value tree just to read again what was already in memory.

  • FluidResources::new(assets, facts) builds the tables from the game's BlockFacts.
  • MotionResources::load_with_facts(root, assets, facts) is what the game calls. load(root, assets) stays for tests and tools and loads the facts itself.

Behaviour doesn't change: the same facts and the same tables, decoded once.

Why

Brief priority 1 (memory below NeoForge's): this is one of the startup peaks examples/resource_memory.rs shows. The motion step had the highest peak after worldgen (1,215 MB with #753 for ATM10's 42 mods).

Checks

  • cargo fmt --all -- --check, cargo clippy -p horizon-client --all-targets -- -D warnings: clean.
  • cargo test -p horizon-client: all pass (fluid and motion tests included).
  • Parity: tools/parity.py --changed origin/main on this work merged together (#753, #754, #755, #756, #764 and #762): 298 harnesses selected, all pass. Three failed on the first run for reasons outside this code, and their reruns passed: datafix lost its connection while generating 1.8.9 sample worlds (load average 140), the Java oracle timed out in decoration, and another session's pkill killed a run.

🤖 Generated with Claude Code


🔄 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/754 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/fluid-facts-once` --- ### 📝 Commits (2) - [`2e531f3`](https://github.com/horizon-rust/horizon/commit/2e531f35e52638330e838036d5b74de600a65216) Per-state tables: check state identities while reading, never as a tree - [`580c2b1`](https://github.com/horizon-rust/horizon/commit/580c2b1dd790d19e7146159d91bd9f8fecb3f4f7) Motion: reuse the game's block facts for the fluid tables ### 📊 Changes **16 files changed** (+440 additions, -129 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/examples/resource_memory.rs` (+1 -15) 📝 `crates/horizon-client/src/collisions.rs` (+4 -10) 📝 `crates/horizon-client/src/game.rs` (+1 -1) 📝 `crates/horizon-client/src/light.rs` (+3 -11) 📝 `crates/horizon-client/src/models.rs` (+3 -5) 📝 `crates/horizon-client/src/motion.rs` (+19 -10) 📝 `crates/horizon-client/src/motion/fluids.rs` (+1 -2) 📝 `crates/horizon-world/src/block_properties.rs` (+18 -17) 📝 `crates/horizon-world/src/block_support.rs` (+12 -4) 📝 `crates/horizon-world/src/collision.rs` (+6 -13) 📝 `crates/horizon-world/src/level/data.rs` (+3 -10) 📝 `crates/horizon-world/src/movement_properties.rs` (+5 -13) 📝 `crates/horizon-world/src/nbt.rs` (+164 -3) 📝 `crates/horizon-world/src/registry.rs` (+117 -0) 📝 `crates/horizon-world/src/worldgen/generator_blocks.rs` (+11 -15) 📝 `crates/horizon-world/tests/collision_data.rs` (+72 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Stacked on #753**: review the last commit (`580c2b1d`). Once #753 merges, this diff drops to that commit. ## What `MotionResources::load` built the fluid tables from `FluidResources::load`, and that call decoded `gameplay-facts.json` again. The game had already decoded the same file into `BlockFacts` one step earlier. With ATM10's carried mods, that file is 211 MB of JSON, so the second decode built a few hundred MB of `serde_json::Value` tree just to read again what was already in memory. - `FluidResources::new(assets, facts)` builds the tables from the game's `BlockFacts`. - `MotionResources::load_with_facts(root, assets, facts)` is what the game calls. `load(root, assets)` stays for tests and tools and loads the facts itself. Behaviour doesn't change: the same facts and the same tables, decoded once. ## Why Brief priority 1 (memory below NeoForge's): this is one of the startup peaks `examples/resource_memory.rs` shows. The `motion` step had the highest peak after worldgen (1,215 MB with #753 for ATM10's 42 mods). ## Checks - `cargo fmt --all -- --check`, `cargo clippy -p horizon-client --all-targets -- -D warnings`: clean. - `cargo test -p horizon-client`: all pass (fluid and motion tests included). - Parity: `tools/parity.py --changed origin/main` on this work merged together (#753, #754, #755, #756, #764 and #762): 298 harnesses selected, **all pass**. Three failed on the first run for reasons outside this code, and their reruns passed: datafix lost its connection while generating 1.8.9 sample worlds (load average 140), the Java oracle timed out in decoration, and another session's `pkill` killed a run. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:59:01 +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#2783
No description provided.