[PR #5053] [CLOSED] Java mod loading: modpacks from an instance folder and a native Java compiler #6028

Closed
opened 2026-11-03 05:16:43 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5053
Author: @ChinoCappuchino
Created: 10/31/2026
Status: ❌ Closed

Base: main ← Head: NeuHorizon


📝 Commits (3)

  • 1b203e7 Java mod loading: modpacks from an instance folder and a native Java compiler
  • 64f8b91 horizon-java native: Windows and macOS, volatile fields, a pool race
  • 97af29a docs: requirements and platforms of Java mod loading

📊 Changes

108 files changed (+42447 additions, -386 deletions)

View changed files

📝 AGENTS.md (+1 -0)
📝 Cargo.lock (+668 -5)
📝 Cargo.toml (+2 -0)
📝 crates/horizon-client-render/src/extras.rs (+9 -1)
📝 crates/horizon-client-render/src/gfx.rs (+1 -1)
📝 crates/horizon-client/Cargo.toml (+2 -0)
➕ crates/horizon-client/examples/splash_frames.rs (+231 -0)
📝 crates/horizon-client/src/creative.rs (+46 -3)
📝 crates/horizon-client/src/game.rs (+119 -3)
➕ crates/horizon-client/src/game/setup_splash.rs (+371 -0)
➕ crates/horizon-client/src/game/splash_window.rs (+302 -0)
📝 crates/horizon-client/src/game/startup_menu.rs (+3 -0)
📝 crates/horizon-client/src/lib.rs (+1 -0)
📝 crates/horizon-client/src/main.rs (+5 -0)
📝 crates/horizon-client/src/mod_content.rs (+648 -37)
📝 crates/horizon-client/src/mod_content_tests.rs (+4 -1)
➕ crates/horizon-client/src/splash.rs (+6 -0)
➕ crates/horizon-client/src/splash/gpu.rs (+1136 -0)
➕ crates/horizon-client/src/splash/splash.wgsl (+140 -0)
➕ crates/horizon-client/src/splash/timeline.rs (+771 -0)

...and 80 more files

📄 Description

Java mod loading: modpacks from an instance folder and a native Java compiler

Summary

This change adds universal loading of NeoForge 1.21.1 modpacks to Horizon.
Horizon's launcher plays a modpack from its folder. An external launcher can
give Horizon an instance folder and the player's session. A native compiler
turns Java mod bytecode into machine code with Cranelift. The parts work as
one unit: import, port, compile, play.

No mods are included. The change has no mod files, no ported mods and no
Mojang files. It is built on today's main: content mods and native code,
with no WebAssembly code mods.

What it adds

  • Modpack import and play: horizon-launcher modpack import, port and
    play read the jars from the instance's mods folder. The loader and the
    game version come from the jars.
  • Launcher handover: an external launcher gives Horizon the player's
    session (HORIZON_SESSION_FILE). Prism Launcher is the first one tested.
    Other launchers can use the same handover.
  • Content mods: blocks with their own states (properties, shapes, light),
    and items that place a block, beside main's shapes and components.
  • Mods' block code: a block-code hook in the world (horizon-world
    level::code) that horizon-neoforge uses.
  • Setup splash: the first setup shows each step and the mod count. A
    cached start skips the setup.
  • Mod items in creative search.
  • Native compiler (horizon-java, feature native): one global dispatch
    table, a parallel streamed compile, a runtime library of JDK classes in Rust,
    and JDK classes from the player's own Java runtime. Java threads are real
    threads: monitors, atomics, volatile fields, thread pools.
  • Documentation (ASD-STE100): docs/java-compat/status.md (what works,
    requirements, platforms), docs/java-compat/AGENTS.md (a guide for the next
    developer), docs/java-compat/rendering.md (the plan for mod rendering).

This change fixes no open issue completely. It relates to these:

Issue or PR Relation
#4331 (content mods: creative tabs and search) This change puts content mods' items in the creative search. #5066 does the same and adds tab pages. Both change creative.rs, mod_content.rs and horizon-mods/src/content.rs: the pull request that merges second rebases. This change's block states and item places are separate from #5066's tabs.
#3545 (a Launch API for other launchers) The launcher handover here (HORIZON_SESSION_FILE) is a step in the same direction. main already has --session-file and --session-stdin; the handover can move to the Launch API when it is complete.
#3915 (roadmap: Java instances in the launcher) Import and play of a modpack from a Prism instance folder.

Requirements

Need Linux (Debian, Ubuntu) Linux (Fedora) Windows macOS
Sound (ALSA) libasound2-dev alsa-lib-devel built in built in
Controllers (udev) libudev-dev systemd-devel built in built in
The game window (X11 keyboard) libxkbcommon-x11-dev libxkbcommon-x11-devel built in built in
JDK classes (level 3), javac for the tests JDK 21 or later JDK 21 or later JDK 21 or later JDK 21 or later

Platforms

Part Linux x86-64 Windows x86-64 macOS (Apple silicon)
Modpack import, port, content mods Tested Builds Builds
Native compiler Tested (18 tests) Builds (--target x86_64-pc-windows-msvc) Builds (--target aarch64-apple-darwin)

The native compiler has its platform parts for each system: the heap
reservation (mmap, or VirtualAlloc with commits in steps on Windows),
stack probes, and atomic volatile fields for ARM64. Its tests have not run
on Windows and macOS yet.

Tested with

Mods Result
Brewin' and Chewin', Chipped, Cook's Collection, Decorative Blocks, End's Delight, Expanded Delight Blocks and items in the game (data tier)
Create, Sable, Create Aeronautics, Flywheel, Veil, Ponder, Registrate, with NeoForge 21.1.251 and Minecraft 1.21.1 The code compiles natively (47,296 classes in 3 min, 6.8 GB). It does not run in the game yet.

Not done yet

  1. The behavior code of mods does not run in the game.
  2. Mixins do not apply. There is no garbage collector.
  3. Mod rendering is a plan only.
  4. The native tests have not run on Windows and macOS.

How to test

  1. Run cargo test --release -p horizon-java --features native --test native.
  2. Make sure that all 18 tests pass. Each test compares its result with the JVM.

Self-check

pr_ready (tools/pr_ready.py --quick on nobara-Server, against origin/main at 13ce6bcc6, 19 min 26 s)

Check Result
Scope ⚠️ 108 files, +42447 −386; 38838 lines of code: over 500, split it if it can ship in parts; mixes game, launcher
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅ (1 s)
Python tests ✅ 495 passed (1 min 24 s)
rustfmt ✅ (20 s)
clippy ✅ (3 min 41 s)
tests: workspace ❌ 1494 passed, then horizon-client-render --lib crashed (SIGSEGV); see below
doc tests ✅ 0 passed (31 s)
content root tests ✅ 7 passed (2 min 37 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (5 s)
launcher clippy ✅ (2 min 10 s)
launcher tests ✅ 306 passed (3 min 36 s)
Parity ➖ 359 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 347 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The workspace tests stopped at a crash in horizon-client-render's library tests.
The crash is intermittent on this machine and also happens on main: 8 runs each
of the same test binary gave 3 crashes on main at 13ce6bcc6 and 4 on this branch.
A run that does not crash passes all 700 tests, in parallel and on one thread. This
change touches that crate only in extras.rs (the splash setting) and in making
gfx::instance_descriptor public.

🤖 Generated with Claude Code

https://claude.ai/code/session_0141AhK3JJCM1SXpis1egRLh


🔄 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/5053 **Author:** [@ChinoCappuchino](https://github.com/ChinoCappuchino) **Created:** 10/31/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `NeuHorizon` --- ### 📝 Commits (3) - [`1b203e7`](https://github.com/horizon-rust/horizon/commit/1b203e750cae2215e62d4d9906e7cf9a810c4ff2) Java mod loading: modpacks from an instance folder and a native Java compiler - [`64f8b91`](https://github.com/horizon-rust/horizon/commit/64f8b91f01fb908d7c3e58814d74b375692ae3b9) horizon-java native: Windows and macOS, volatile fields, a pool race - [`97af29a`](https://github.com/horizon-rust/horizon/commit/97af29a389a88fc8ccd91eb482eb8a36b38f2371) docs: requirements and platforms of Java mod loading ### 📊 Changes **108 files changed** (+42447 additions, -386 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+1 -0) 📝 `Cargo.lock` (+668 -5) 📝 `Cargo.toml` (+2 -0) 📝 `crates/horizon-client-render/src/extras.rs` (+9 -1) 📝 `crates/horizon-client-render/src/gfx.rs` (+1 -1) 📝 `crates/horizon-client/Cargo.toml` (+2 -0) ➕ `crates/horizon-client/examples/splash_frames.rs` (+231 -0) 📝 `crates/horizon-client/src/creative.rs` (+46 -3) 📝 `crates/horizon-client/src/game.rs` (+119 -3) ➕ `crates/horizon-client/src/game/setup_splash.rs` (+371 -0) ➕ `crates/horizon-client/src/game/splash_window.rs` (+302 -0) 📝 `crates/horizon-client/src/game/startup_menu.rs` (+3 -0) 📝 `crates/horizon-client/src/lib.rs` (+1 -0) 📝 `crates/horizon-client/src/main.rs` (+5 -0) 📝 `crates/horizon-client/src/mod_content.rs` (+648 -37) 📝 `crates/horizon-client/src/mod_content_tests.rs` (+4 -1) ➕ `crates/horizon-client/src/splash.rs` (+6 -0) ➕ `crates/horizon-client/src/splash/gpu.rs` (+1136 -0) ➕ `crates/horizon-client/src/splash/splash.wgsl` (+140 -0) ➕ `crates/horizon-client/src/splash/timeline.rs` (+771 -0) _...and 80 more files_ </details> ### 📄 Description ## Java mod loading: modpacks from an instance folder and a native Java compiler ### Summary This change adds universal loading of NeoForge 1.21.1 modpacks to Horizon. Horizon's launcher plays a modpack from its folder. An external launcher can give Horizon an instance folder and the player's session. A native compiler turns Java mod bytecode into machine code with Cranelift. The parts work as one unit: import, port, compile, play. No mods are included. The change has no mod files, no ported mods and no Mojang files. It is built on today's `main`: content mods and native code, with no WebAssembly code mods. ### What it adds - **Modpack import and play:** `horizon-launcher modpack import`, `port` and `play` read the jars from the instance's `mods` folder. The loader and the game version come from the jars. - **Launcher handover:** an external launcher gives Horizon the player's session (`HORIZON_SESSION_FILE`). Prism Launcher is the first one tested. Other launchers can use the same handover. - **Content mods:** blocks with their own states (properties, shapes, light), and items that place a block, beside `main`'s shapes and components. - **Mods' block code:** a block-code hook in the world (`horizon-world` `level::code`) that `horizon-neoforge` uses. - **Setup splash:** the first setup shows each step and the mod count. A cached start skips the setup. - **Mod items in creative search.** - **Native compiler (`horizon-java`, feature `native`):** one global dispatch table, a parallel streamed compile, a runtime library of JDK classes in Rust, and JDK classes from the player's own Java runtime. Java threads are real threads: monitors, atomics, `volatile` fields, thread pools. - **Documentation (ASD-STE100):** `docs/java-compat/status.md` (what works, requirements, platforms), `docs/java-compat/AGENTS.md` (a guide for the next developer), `docs/java-compat/rendering.md` (the plan for mod rendering). ### Related issues This change fixes no open issue completely. It relates to these: | Issue or PR | Relation | |---|---| | #4331 (content mods: creative tabs and search) | This change puts content mods' items in the creative search. #5066 does the same and adds tab pages. Both change `creative.rs`, `mod_content.rs` and `horizon-mods/src/content.rs`: the pull request that merges second rebases. This change's block states and item `places` are separate from #5066's tabs. | | #3545 (a Launch API for other launchers) | The launcher handover here (`HORIZON_SESSION_FILE`) is a step in the same direction. `main` already has `--session-file` and `--session-stdin`; the handover can move to the Launch API when it is complete. | | #3915 (roadmap: Java instances in the launcher) | Import and play of a modpack from a Prism instance folder. | ### Requirements | Need | Linux (Debian, Ubuntu) | Linux (Fedora) | Windows | macOS | |---|---|---|---|---| | Sound (ALSA) | `libasound2-dev` | `alsa-lib-devel` | built in | built in | | Controllers (udev) | `libudev-dev` | `systemd-devel` | built in | built in | | The game window (X11 keyboard) | `libxkbcommon-x11-dev` | `libxkbcommon-x11-devel` | built in | built in | | JDK classes (level 3), `javac` for the tests | JDK 21 or later | JDK 21 or later | JDK 21 or later | JDK 21 or later | ### Platforms | Part | Linux x86-64 | Windows x86-64 | macOS (Apple silicon) | |---|---|---|---| | Modpack import, port, content mods | Tested | Builds | Builds | | Native compiler | Tested (18 tests) | Builds (`--target x86_64-pc-windows-msvc`) | Builds (`--target aarch64-apple-darwin`) | The native compiler has its platform parts for each system: the heap reservation (`mmap`, or `VirtualAlloc` with commits in steps on Windows), stack probes, and atomic `volatile` fields for ARM64. Its tests have not run on Windows and macOS yet. ### Tested with | Mods | Result | |---|---| | Brewin' and Chewin', Chipped, Cook's Collection, Decorative Blocks, End's Delight, Expanded Delight | Blocks and items in the game (data tier) | | Create, Sable, Create Aeronautics, Flywheel, Veil, Ponder, Registrate, with NeoForge 21.1.251 and Minecraft 1.21.1 | The code compiles natively (47,296 classes in 3 min, 6.8 GB). It does not run in the game yet. | ### Not done yet 1. The behavior code of mods does not run in the game. 2. Mixins do not apply. There is no garbage collector. 3. Mod rendering is a plan only. 4. The native tests have not run on Windows and macOS. ### How to test 1. Run `cargo test --release -p horizon-java --features native --test native`. 2. Make sure that all 18 tests pass. Each test compares its result with the JVM. ### Self-check **pr_ready** (`tools/pr_ready.py --quick` on nobara-Server, against origin/main at 13ce6bcc6, 19 min 26 s) | Check | Result | | --- | --- | | Scope | ⚠️ 108 files, +42447 −386; 38838 lines of code: over 500, split it if it can ship in parts; mixes game, launcher | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ (1 s) | | Python tests | ✅ 495 passed (1 min 24 s) | | rustfmt | ✅ (20 s) | | clippy | ✅ (3 min 41 s) | | tests: workspace | ❌ 1494 passed, then `horizon-client-render --lib` crashed (SIGSEGV); see below | | doc tests | ✅ 0 passed (31 s) | | content root tests | ✅ 7 passed (2 min 37 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (5 s) | | launcher clippy | ✅ (2 min 10 s) | | launcher tests | ✅ 306 passed (3 min 36 s) | | Parity | ➖ 359 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 347 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The workspace tests stopped at a crash in `horizon-client-render`'s library tests. The crash is intermittent on this machine and also happens on `main`: 8 runs each of the same test binary gave 3 crashes on `main` at 13ce6bcc6 and 4 on this branch. A run that does not crash passes all 700 tests, in parallel and on one thread. This change touches that crate only in `extras.rs` (the splash setting) and in making `gfx::instance_descriptor` public. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0141AhK3JJCM1SXpis1egRLh --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:43 +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#6028
No description provided.