[PR #7740] launcher: install and launch Forge and NeoForge instances #7796

Open
opened 2026-11-03 07:24:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7740
Author: @ludovic111
Created: 11/2/2026
Status: 🔄 Open

Base: launcher-forge-versions ← Head: launcher-forge-install


📝 Commits (1)

  • d9e8401 launcher: install and launch Forge and NeoForge instances

📊 Changes

9 files changed (+736 additions, -31 deletions)

View changed files

📝 docs/design-system.md (+1 -1)
📝 launcher/src/backend.rs (+27 -15)
📝 launcher/src/java_launch.rs (+3 -2)
📝 launcher/src/loaders.rs (+15 -4)
📝 launcher/src/loaders/forge.rs (+1 -1)
➕ launcher/src/loaders/forge_install.rs (+421 -0)
➕ launcher/src/loaders/forge_install_tests.rs (+255 -0)
📝 launcher/src/loaders/tests.rs (+9 -4)
📝 launcher/src/new_instance.rs (+4 -4)

📄 Description

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

Part of #7733 (roadmap #3915). Stacked on #7736 (version lists); it retargets to main once that one merges. Together they let a Java instance play Forge or NeoForge.

Install (launcher/src/loaders/forge_install.rs), from the installers' public format:

  1. Download <artifact>-<version>-installer.jar from Forge's or NeoForge's Maven repository and check it against the .sha1 the repository publishes next to it.
  2. Read install_profile.json and the profile it names (json). Refuse one built for another Minecraft version, and say so for pre-1.12.2 installers (versionInfo): they are not handled yet.
  3. Put every library from both lists in libraries/. Keep a file whose sha1 already matches; otherwise take it from the installer's maven/ folder or download it (up to 8 at a time). Either way the sha1 is checked against the one listed.
  4. Run the client's processors on the instance's Java: java -cp <jar + classpath> <the jar's Main-Class> <args>, where args come from the install profile's data ([coords] a library file, 'text' a literal, /path a file the installer carries) plus SIDE, MINECRAFT_JAR, MINECRAFT_VERSION, ROOT, INSTALLER and LIBRARY_DIR. A processor whose outputs already have the expected sha1 is skipped. One that writes an output with a different sha1 fails the install, and that file is deleted.
  5. Check that the libraries the processors were supposed to make exist with their sha1. Then save the profile as versions/<id>/<id>.json (1.20.1-forge-47.3.0, neoforge-21.1.77, 1.20.1-neoforge-…, so NeoForge's 1.20.1 builds never collide with Forge's own 47.1 builds), next to a copy of the game's jar named after the id. Forge's -DignoreList expects that name (${version_name}.jar), and the official launcher lays out its files the same way. java_launch::resolve now lets a child profile name its own jar.

Launch: backend::java_game now picks (or downloads) the Java before installing the loader, so the installer runs on the same Java as the game. Everything else is unchanged: account::java_player and Mojang's owner-gated download come first, then java_launch::command.

UI (minimal, new_instance.rs): the Modded loader picker shows every loaders::Kind with its logo (Forge's and NeoForge's logos were already in instance_icons).

Evidence

  • an_installer_runs_its_processors_and_checks_what_they_make (unix): a Forge-shaped installer with a bundled library, a downloaded one and a processor-made one. The processor runs on a stand-in java. Checked: it got its jar's Main-Class, its classpath and MINECRAFT_JAR; the made jar equals game jar + patch (expected sha1 computed independently); the server-side processor never ran; a second install doesn't run the processor again (the stand-in java is deleted first); a wrong output sha1 fails and the file is removed; a tampered download is refused; an installer for another Minecraft version is refused.
  • Real installers, real processors, real repositories (a_real_installer_installs, --ignored), on the Mac mini with Temurin 25 in a scratch game folder holding a clone of the local 26.3 client jar. Nothing was downloaded from Mojang:
    • forge:26.3: "Downloading the Forge 66.1.0 installer · Downloading Forge 66.1.0 (56 libraries) · Patching Minecraft (1/1: binarypatcher)": ok. binarypatcher's output matched the installer's PATCHED_SHA.
    • neoforge:26.3: "Downloading the NeoForge 26.3.0.101 installer · Downloading NeoForge 26.3.0.101 (57 libraries) · Patching Minecraft (1/1: installertools)": ok.
    • For both, every library in the loader's profile and its copy of the game jar are on java_launch::classpath and exist on disk.
  • Not yet: a real game start. That needs an account that owns the game, through account::launch, and the launcher on this Mac has none signed in. No owner-gate bypass was used. Pending Ludovic's sign-in; the result will be added here.

Forge's installer profile asks launchers not to automate its install and points to its Patreon. Every third-party launcher installs it this way; the loader picker could link the Patreon if Ludovic wants.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 76d1cb530, 4 min 45 s)

Check Result
Scope ⚠️ 17 files, +1010 −57; 1029 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (3 min 34 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
content root tests ➖ content root untouched
mod API up to date ➖ native hooks untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (2 s)
launcher clippy ✅ (37 s)
launcher tests ✅ 456 passed (32 s)
Parity ➖ 18 affected, to run in CI (--quick): anvil_turtle_egg, armor_stand_frost, armor_stand_turtle_egg, arrow_wind_charge, boat_authority, boat_paddle_reset, boat_submerged, dragon_contacts, dragon_render, enchantment_components, fishing_hook_entities, inline_object and 6 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

(pr_ready ran against origin/main, so its Scope row counts both stacked PRs. This PR alone is +727 −31, 246 of those lines tests.) Launcher workspace: clippy clean, 456 + 76 tests passed.

🤖 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/7740 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `launcher-forge-versions` ← **Head:** `launcher-forge-install` --- ### 📝 Commits (1) - [`d9e8401`](https://github.com/horizon-rust/horizon/commit/d9e84015586374be720c2377278ce440486fd5f5) launcher: install and launch Forge and NeoForge instances ### 📊 Changes **9 files changed** (+736 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `docs/design-system.md` (+1 -1) 📝 `launcher/src/backend.rs` (+27 -15) 📝 `launcher/src/java_launch.rs` (+3 -2) 📝 `launcher/src/loaders.rs` (+15 -4) 📝 `launcher/src/loaders/forge.rs` (+1 -1) ➕ `launcher/src/loaders/forge_install.rs` (+421 -0) ➕ `launcher/src/loaders/forge_install_tests.rs` (+255 -0) 📝 `launcher/src/loaders/tests.rs` (+9 -4) 📝 `launcher/src/new_instance.rs` (+4 -4) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #7733 (roadmap #3915). Stacked on #7736 (version lists); it retargets to main once that one merges. Together they let a Java instance play Forge or NeoForge. **Install** (`launcher/src/loaders/forge_install.rs`), from the installers' public format: 1. Download `<artifact>-<version>-installer.jar` from Forge's or NeoForge's Maven repository and check it against the `.sha1` the repository publishes next to it. 2. Read `install_profile.json` and the profile it names (`json`). Refuse one built for another Minecraft version, and say so for pre-1.12.2 installers (`versionInfo`): they are not handled yet. 3. Put every library from both lists in `libraries/`. Keep a file whose sha1 already matches; otherwise take it from the installer's `maven/` folder or download it (up to 8 at a time). Either way the sha1 is checked against the one listed. 4. Run the client's processors on **the instance's Java**: `java -cp <jar + classpath> <the jar's Main-Class> <args>`, where args come from the install profile's `data` (`[coords]` a library file, `'text'` a literal, `/path` a file the installer carries) plus `SIDE`, `MINECRAFT_JAR`, `MINECRAFT_VERSION`, `ROOT`, `INSTALLER` and `LIBRARY_DIR`. A processor whose `outputs` already have the expected sha1 is skipped. One that writes an output with a different sha1 fails the install, and that file is deleted. 5. Check that the libraries the processors were supposed to make exist with their sha1. Then save the profile as `versions/<id>/<id>.json` (`1.20.1-forge-47.3.0`, `neoforge-21.1.77`, `1.20.1-neoforge-…`, so NeoForge's 1.20.1 builds never collide with Forge's own 47.1 builds), next to a copy of the game's jar named after the id. Forge's `-DignoreList` expects that name (`${version_name}.jar`), and the official launcher lays out its files the same way. `java_launch::resolve` now lets a child profile name its own `jar`. **Launch**: `backend::java_game` now picks (or downloads) the Java before installing the loader, so the installer runs on the same Java as the game. Everything else is unchanged: `account::java_player` and Mojang's owner-gated download come first, then `java_launch::command`. **UI** (minimal, `new_instance.rs`): the Modded loader picker shows every `loaders::Kind` with its logo (Forge's and NeoForge's logos were already in `instance_icons`). **Evidence** - `an_installer_runs_its_processors_and_checks_what_they_make` (unix): a Forge-shaped installer with a bundled library, a downloaded one and a processor-made one. The processor runs on a stand-in `java`. Checked: it got its jar's `Main-Class`, its classpath and `MINECRAFT_JAR`; the made jar equals game jar + patch (expected sha1 computed independently); the server-side processor never ran; a second install doesn't run the processor again (the stand-in `java` is deleted first); a wrong output sha1 fails and the file is removed; a tampered download is refused; an installer for another Minecraft version is refused. - Real installers, real processors, real repositories (`a_real_installer_installs`, `--ignored`), on the Mac mini with Temurin 25 in a scratch game folder holding a clone of the local 26.3 client jar. Nothing was downloaded from Mojang: - `forge:26.3`: "Downloading the Forge 66.1.0 installer · Downloading Forge 66.1.0 (56 libraries) · Patching Minecraft (1/1: binarypatcher)": ok. binarypatcher's output matched the installer's `PATCHED_SHA`. - `neoforge:26.3`: "Downloading the NeoForge 26.3.0.101 installer · Downloading NeoForge 26.3.0.101 (57 libraries) · Patching Minecraft (1/1: installertools)": ok. - For both, every library in the loader's profile and its copy of the game jar are on `java_launch::classpath` and exist on disk. - **Not yet: a real game start.** That needs an account that owns the game, through `account::launch`, and the launcher on this Mac has none signed in. No owner-gate bypass was used. Pending Ludovic's sign-in; the result will be added here. Forge's installer profile asks launchers not to automate its install and points to its Patreon. Every third-party launcher installs it this way; the loader picker could link the Patreon if Ludovic wants. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 76d1cb530, 4 min 45 s) | Check | Result | | --- | --- | | Scope | ⚠️ 17 files, +1010 −57; 1029 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (3 min 34 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (2 s) | | launcher clippy | ✅ (37 s) | | launcher tests | ✅ 456 passed (32 s) | | Parity | ➖ 18 affected, to run in CI (--quick): anvil_turtle_egg, armor_stand_frost, armor_stand_turtle_egg, arrow_wind_charge, boat_authority, boat_paddle_reset, boat_submerged, dragon_contacts, dragon_render, enchantment_components, fishing_hook_entities, inline_object and 6 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | (pr_ready ran against origin/main, so its Scope row counts both stacked PRs. This PR alone is +727 −31, 246 of those lines tests.) Launcher workspace: clippy clean, 456 + 76 tests passed. 🤖 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>
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#7796
No description provided.