[PR #438] [MERGED] Launcher: prepare from Prism, MultiMC, Modrinth App, ATLauncher or GDLauncher #2568

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

📋 Pull Request Information

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

Base: main ← Head: feat/launcher-other-launchers


📝 Commits (2)

  • 561efb3 launcher: say which folders were checked when Minecraft is not found
  • b2e9faf launcher: prepare from Prism, MultiMC, Modrinth App, ATLauncher or GDLauncher

📊 Changes

9 files changed (+881 additions, -34 deletions)

View changed files

📝 launcher/Cargo.lock (+1 -0)
📝 launcher/Cargo.toml (+2 -0)
📝 launcher/src/backend.rs (+44 -25)
📝 launcher/src/cli.rs (+4 -2)
📝 launcher/src/lib.rs (+1 -0)
📝 launcher/src/main.rs (+11 -5)
📝 launcher/src/mcp.rs (+2 -2)
➕ launcher/src/sources.rs (+407 -0)
➕ launcher/src/sources_tests.rs (+409 -0)

📄 Description

Part of #434. Stacked on #437 (merge that first; this PR then retargets to main).

What

The official launcher crashes on some Linux systems (rdbt's Arch: "Service Crash: minecraft-launcher has encountered a fatal error"), and Horizon could only read the official launcher's folder. Prepare now finds Minecraft 26.3 wherever the player already has it.

Where it looks, in order:

  1. The chosen folder, then up to three folders above it, so picking an instance folder like PrismLauncher/instances/26.3/minecraft also works.
  2. Every launcher's default folder:
Linux macOS Windows
official ~/.minecraft, Flatpak ~/.var/app/com.mojang.Minecraft/.minecraft ~/Library/Application Support/minecraft %APPDATA%\.minecraft
Prism Launcher $XDG_DATA_HOME/PrismLauncher, Flatpak ~/.var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher …/Application Support/PrismLauncher %APPDATA%\PrismLauncher
MultiMC $XDG_DATA_HOME/multimc …/MultiMC portable: choose it
Modrinth App $XDG_DATA_HOME/ModrinthApp, Flatpak com.modrinth.ModrinthApp, old com.modrinth.theseus same names same names
ATLauncher $XDG_DATA_HOME/atlauncher, Flatpak com.atlauncher.ATLauncher …/ATLauncher %APPDATA%\ATLauncher
GDLauncher gdlauncher_carbon (data dir), gdlauncher_next (config dir) same same

How each launcher's files are read. The client jar is located, then checked against the lock's client_sha1:

  • Official launcher: versions/<v>/<v>.jar.
  • Prism Launcher / MultiMC: their own meta/net.minecraft/<v>.json format. mainJar.name, a Maven name such as com.mojang:minecraft:26.3:client, becomes a path under libraries/ (maven_path, unit-tested). The default libraries/com/mojang/minecraft/<v>/minecraft-<v>-client.jar is tried too.
  • Modrinth App: meta/versions/<v>/<v>.jar, with meta/libraries and meta/assets.
  • ATLauncher and GDLauncher (data/, or Next's datastore/): libraries/net/minecraft/client/<v>/client-<v>.jar.

Why the files are linked rather than translated. horizon-prepare reads the official layout, and it pins the version JSON's own sha1 (manifest_sha1 / accepted_manifest_sha1). A JSON rebuilt from Prism's or Modrinth's metadata would always be refused, and Prism's format has no server download at all. So the launcher builds an official layout in <data dir>/linked-minecraft/:

  • versions/<v>/<v>.jar links to the launcher's jar; libraries/ and assets/ link to the launcher's folders (symlinks; on Windows a junction or hard link).
  • versions/<v>/<v>.json is the launcher's own copy when it is a pinned one. Otherwise the pinned file is fetched from https://piston-meta.mojang.com/v1/packages/<manifest_sha1>/<v>.json, its sha1 checked, and kept for later runs. That file is public metadata, fetched the same way the server jar already is. No game file is downloaded or shipped.
  • Every preparer reads the linked folder as an official one: in-process, a version's own horizon-prepare, and the old Python one.

Other changes:

  • A complete official folder is still used as is, with no links. An official folder whose version file is a republished one Horizon doesn't know yet now gets the pinned JSON instead of failing.
  • When nothing is found, the #437 error lists the chosen folder and every installed launcher's folder, each with what it lacks. For example: (Prism Launcher: no Minecraft 26.3 client jar) or (… is not the 26.3 release Horizon was made for).
  • The "Minecraft folder" setting defaults to the official folder, else the first other launcher folder found. CLI --minecraft and MCP minecraft_dir docs name the other launchers.

Size: 872 lines changed, of which sources_tests.rs is about 380.

How tested

Real end-to-end run on the Mac mini. Real 26.3 files, taken from shared-local and only in /tmp (deleted afterwards, never committed), were laid out like Prism: libraries, the client jar at libraries/com/mojang/minecraft/26.3/minecraft-26.3-client.jar, and a Prism-format meta/net.minecraft/26.3.json. Then, with a scratch launcher home and v2026.10.15.20 freshly installed:

$ horizon-launcher prepare --version v2026.10.15.20 --minecraft /tmp/hz-sources/PrismLauncher/instances/26.3/minecraft
Using Minecraft 26.3 from the chosen folder (/tmp/hz-sources/PrismLauncher)
Downloading the 26.3 version file from Mojang
Downloading the 26.3 server jar from Mojang
Imported client 26.3 from /tmp/hz-sources/home/linked-minecraft
…
v2026.10.15.20 is prepared.         (exit 0, 8 min 32 s)

There was no sound in this run because the fixture had no assets/. With a real Prism folder, assets/ is linked and the sounds are copied.

Fixture tests (sources_tests.rs, small fake jars and JSONs, nothing from Mojang, piston-meta mocked):

  • each launcher's layout: official as is, official with an unknown version file, Prism through its metadata, a mainJar found only through the metadata, Modrinth App, ATLauncher, GDLauncher, GDLauncher Next;
  • an instance folder chosen;
  • the default folders searched after the chosen one;
  • relinking when the source launcher changes (old links removed, the launcher's real folders untouched);
  • the error listing every folder;
  • a fetched version file with the wrong sha1 refused;
  • the Linux, macOS and Windows folder lists.

Only covered by unit tests: the Linux and Flatpak paths, the Windows paths, and the Windows junction / hard link code (make_link for cfg(windows) is not compiled on macOS or Linux CI). The ATLauncher and GDLauncher jar paths come from those launchers' sources as I remember them, not from a real install. A wrong guess fails safely: the jar is sha1-checked, and the folder is listed in the error.

cargo fmt --check                                                       ok
cargo clippy --features gpui/runtime_shaders --all-targets -D warnings  ok (launcher)
cargo test --features gpui/runtime_shaders                              ok (44 + 4 + 1 passed, 1 ignored)
tools/parity.py --changed origin/main --list                            0 harnesses depend on launcher/

Needs Ludovic

Nothing. rdbt can try it on Arch once this is in a launcher release: install 26.3 in Prism Launcher, start it once, then press Prepare.

🤖 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/438 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-other-launchers` --- ### 📝 Commits (2) - [`561efb3`](https://github.com/horizon-rust/horizon/commit/561efb340ea1473e1ed1a62e2a28b3c411107571) launcher: say which folders were checked when Minecraft is not found - [`b2e9faf`](https://github.com/horizon-rust/horizon/commit/b2e9fafbe0b918435a40af37410584854fe556b8) launcher: prepare from Prism, MultiMC, Modrinth App, ATLauncher or GDLauncher ### 📊 Changes **9 files changed** (+881 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `launcher/Cargo.lock` (+1 -0) 📝 `launcher/Cargo.toml` (+2 -0) 📝 `launcher/src/backend.rs` (+44 -25) 📝 `launcher/src/cli.rs` (+4 -2) 📝 `launcher/src/lib.rs` (+1 -0) 📝 `launcher/src/main.rs` (+11 -5) 📝 `launcher/src/mcp.rs` (+2 -2) ➕ `launcher/src/sources.rs` (+407 -0) ➕ `launcher/src/sources_tests.rs` (+409 -0) </details> ### 📄 Description Part of #434. Stacked on #437 (merge that first; this PR then retargets to main). ## What The official launcher crashes on some Linux systems (rdbt's Arch: "Service Crash: minecraft-launcher has encountered a fatal error"), and Horizon could only read the official launcher's folder. Prepare now finds Minecraft 26.3 wherever the player already has it. **Where it looks**, in order: 1. The chosen folder, then up to three folders above it, so picking an instance folder like `PrismLauncher/instances/26.3/minecraft` also works. 2. Every launcher's default folder: | | Linux | macOS | Windows | |---|---|---|---| | official | `~/.minecraft`, Flatpak `~/.var/app/com.mojang.Minecraft/.minecraft` | `~/Library/Application Support/minecraft` | `%APPDATA%\.minecraft` | | Prism Launcher | `$XDG_DATA_HOME/PrismLauncher`, Flatpak `~/.var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher` | `…/Application Support/PrismLauncher` | `%APPDATA%\PrismLauncher` | | MultiMC | `$XDG_DATA_HOME/multimc` | `…/MultiMC` | portable: choose it | | Modrinth App | `$XDG_DATA_HOME/ModrinthApp`, Flatpak `com.modrinth.ModrinthApp`, old `com.modrinth.theseus` | same names | same names | | ATLauncher | `$XDG_DATA_HOME/atlauncher`, Flatpak `com.atlauncher.ATLauncher` | `…/ATLauncher` | `%APPDATA%\ATLauncher` | | GDLauncher | `gdlauncher_carbon` (data dir), `gdlauncher_next` (config dir) | same | same | **How each launcher's files are read.** The client jar is located, then checked against the lock's `client_sha1`: - Official launcher: `versions/<v>/<v>.jar`. - Prism Launcher / MultiMC: their own `meta/net.minecraft/<v>.json` format. `mainJar.name`, a Maven name such as `com.mojang:minecraft:26.3:client`, becomes a path under `libraries/` (`maven_path`, unit-tested). The default `libraries/com/mojang/minecraft/<v>/minecraft-<v>-client.jar` is tried too. - Modrinth App: `meta/versions/<v>/<v>.jar`, with `meta/libraries` and `meta/assets`. - ATLauncher and GDLauncher (`data/`, or Next's `datastore/`): `libraries/net/minecraft/client/<v>/client-<v>.jar`. **Why the files are linked rather than translated.** horizon-prepare reads the official layout, and it pins the version JSON's *own* sha1 (`manifest_sha1` / `accepted_manifest_sha1`). A JSON rebuilt from Prism's or Modrinth's metadata would always be refused, and Prism's format has no server download at all. So the launcher builds an official layout in `<data dir>/linked-minecraft/`: - `versions/<v>/<v>.jar` links to the launcher's jar; `libraries/` and `assets/` link to the launcher's folders (symlinks; on Windows a junction or hard link). - `versions/<v>/<v>.json` is the launcher's own copy when it is a pinned one. Otherwise the pinned file is fetched from `https://piston-meta.mojang.com/v1/packages/<manifest_sha1>/<v>.json`, its sha1 checked, and kept for later runs. That file is public metadata, fetched the same way the server jar already is. No game file is downloaded or shipped. - Every preparer reads the linked folder as an official one: in-process, a version's own `horizon-prepare`, and the old Python one. Other changes: - A complete official folder is still used as is, with no links. An official folder whose version file is a republished one Horizon doesn't know yet now gets the pinned JSON instead of failing. - When nothing is found, the #437 error lists the chosen folder and every installed launcher's folder, each with what it lacks. For example: `(Prism Launcher: no Minecraft 26.3 client jar)` or `(… is not the 26.3 release Horizon was made for)`. - The "Minecraft folder" setting defaults to the official folder, else the first other launcher folder found. CLI `--minecraft` and MCP `minecraft_dir` docs name the other launchers. Size: 872 lines changed, of which `sources_tests.rs` is about 380. ## How tested **Real end-to-end run on the Mac mini.** Real 26.3 files, taken from shared-local and only in `/tmp` (deleted afterwards, never committed), were laid out like Prism: libraries, the client jar at `libraries/com/mojang/minecraft/26.3/minecraft-26.3-client.jar`, and a Prism-format `meta/net.minecraft/26.3.json`. Then, with a scratch launcher home and v2026.10.15.20 freshly installed: ``` $ horizon-launcher prepare --version v2026.10.15.20 --minecraft /tmp/hz-sources/PrismLauncher/instances/26.3/minecraft Using Minecraft 26.3 from the chosen folder (/tmp/hz-sources/PrismLauncher) Downloading the 26.3 version file from Mojang Downloading the 26.3 server jar from Mojang Imported client 26.3 from /tmp/hz-sources/home/linked-minecraft … v2026.10.15.20 is prepared. (exit 0, 8 min 32 s) ``` There was no sound in this run because the fixture had no `assets/`. With a real Prism folder, `assets/` is linked and the sounds are copied. **Fixture tests** (`sources_tests.rs`, small fake jars and JSONs, nothing from Mojang, piston-meta mocked): - each launcher's layout: official as is, official with an unknown version file, Prism through its metadata, a `mainJar` found only through the metadata, Modrinth App, ATLauncher, GDLauncher, GDLauncher Next; - an instance folder chosen; - the default folders searched after the chosen one; - relinking when the source launcher changes (old links removed, the launcher's real folders untouched); - the error listing every folder; - a fetched version file with the wrong sha1 refused; - the Linux, macOS and Windows folder lists. **Only covered by unit tests:** the Linux and Flatpak paths, the Windows paths, and the Windows junction / hard link code (`make_link` for `cfg(windows)` is not compiled on macOS or Linux CI). The ATLauncher and GDLauncher jar paths come from those launchers' sources as I remember them, not from a real install. A wrong guess fails safely: the jar is sha1-checked, and the folder is listed in the error. ``` cargo fmt --check ok cargo clippy --features gpui/runtime_shaders --all-targets -D warnings ok (launcher) cargo test --features gpui/runtime_shaders ok (44 + 4 + 1 passed, 1 ignored) tools/parity.py --changed origin/main --list 0 harnesses depend on launcher/ ``` ## Needs Ludovic Nothing. rdbt can try it on Arch once this is in a launcher release: install 26.3 in Prism Launcher, start it once, then press Prepare. 🤖 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:57:15 +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#2568
No description provided.