[PR #3395] [MERGED] Launcher: Minecraft: Java Edition instances (model, version list, CLI) #4951

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

📋 Pull Request Information

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

Base: main ← Head: feat/launcher-java-instances


📝 Commits (4)

  • b44da42 Launcher: Minecraft: Java Edition instances (model, versions, CLI)
  • ae01d87 Merge remote-tracking branch 'origin/main' into feat/launcher-java-instances
  • 21a0656 docs: launcher command reference for the Java instance commands
  • 2034db1 Merge remote-tracking branch 'origin/main' into feat/launcher-java-instances

📊 Changes

8 files changed (+395 additions, -15 deletions)

View changed files

📝 docs/launcher-commands.md (+26 -0)
📝 launcher/README.md (+3 -0)
📝 launcher/src/cli.rs (+84 -7)
📝 launcher/src/import/tests.rs (+1 -0)
📝 launcher/src/instances.rs (+62 -0)
📝 launcher/src/instances/tests.rs (+45 -8)
📝 launcher/src/lib.rs (+1 -0)
➕ launcher/src/minecraft_versions.rs (+173 -0)

📄 Description

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

What and why

This is the second piece of Minecraft: Java Edition instances: the instance itself. A player can now make an instance that plays a chosen version of the real game, with its own Java settings. Downloading that version and launching it come in the next PRs. Until then, Play on such an instance says so in a clear sentence. The window's New instance dialog comes with the launcher redesign.

Changes

  • instances.rs:
    • Meta and Instance get java: Option<JavaGame>, with minecraft (the version id) and optionally home (a Java home instead of the automatic pick), memory_mb (-Xmx, default 4 GiB) and jvm_args. It is absent from instances.json for Horizon instances, so existing files don't change.
    • create_java(name, minecraft) makes the instance with an empty game folder: Horizon's options.txt and offline-name file are not copied into the real game. A copy of a Java instance keeps its section.
    • Play's refusal sits in Instance::horizon(), which resolve_version and apply both call, so the window, the CLI and MCP all show it.
  • minecraft_versions.rs, new: Mojang's public version_manifest_v2.json from piston-meta, the same list the official launcher reads.
    • It parses releases, snapshots, old betas and alphas, plus the latest release and snapshot; find("latest" | "latest-snapshot" | id).
    • The list is kept in minecraft/ in the data folder, so it shows offline. It is metadata only: the game's files stay behind the owner check in mojang.rs.
  • CLI:
    • instance create <name> --minecraft <id|latest|latest-snapshot>
    • instance versions [--snapshots] [--old]
    • instance java <instance> [--home <dir>|--auto] [--memory <MiB>] [--args "<jvm args>"], refused for Horizon instances
    • instance list (text and --json) shows the version.
  • launcher/README.md: the new commands.

This is independent of #3386 (Java runtimes): either can merge first. The launch PR joins the two.

Tested

  • New tests: a_java_instance_plays_one_minecraft_version_in_its_own_folder (empty folder, the entry in instances.json, a copy keeps it, Horizon instances unchanged, Play refused, editing memory), plus the version list's parsing and finding, and the kept list showing offline. Existing instance tests are updated for the new argument.
  • By hand, in fresh mktemp -d homes:
    • instance versions listed 26.3 first, and --old ended with rd-132211.
    • instance create Vanilla --minecraft latest made a 26.3 Java instance.
    • instance java Vanilla --memory 6144 --args "-XX:+UseZGC" was saved.
    • instance java Horizon was refused.
    • play --instance Old (1.12.2) printed the refusal.
    • The real launcher folder was untouched.
  • account::tests::the_whole_chain fails on the Mac mini only, because a local node process (this machine's agent tooling detecting dev servers, user-agent node) sends GET / to every new localhost port, and that test's mock server logs every request. I confirmed it by logging the stray request's headers. This PR doesn't touch accounts; CI has no such process. The rest of the run:

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at abd1755f9, 3 min 34 s)

Check Result
Scope ✅ 7 files, +369 −15
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 405 passed (3 min 24 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (3 s)
launcher clippy ✅ (1 s)
launcher tests ❌ 233 passed, 1 failed (4 s)
Parity ➖ 1 affected, to run in CI (--quick): lan_integration
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Label: feature.

🤖 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/3395 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/28/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-java-instances` --- ### 📝 Commits (4) - [`b44da42`](https://github.com/horizon-rust/horizon/commit/b44da42ca4e956f1e283836f839857b423a2187d) Launcher: Minecraft: Java Edition instances (model, versions, CLI) - [`ae01d87`](https://github.com/horizon-rust/horizon/commit/ae01d872fbc3f1519cef952c254e2782ae582c53) Merge remote-tracking branch 'origin/main' into feat/launcher-java-instances - [`21a0656`](https://github.com/horizon-rust/horizon/commit/21a065653014939c3ce8c1725c5d2520e7ea2cfd) docs: launcher command reference for the Java instance commands - [`2034db1`](https://github.com/horizon-rust/horizon/commit/2034db1df62561666488dd90240736ddde5fa91a) Merge remote-tracking branch 'origin/main' into feat/launcher-java-instances ### 📊 Changes **8 files changed** (+395 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `docs/launcher-commands.md` (+26 -0) 📝 `launcher/README.md` (+3 -0) 📝 `launcher/src/cli.rs` (+84 -7) 📝 `launcher/src/import/tests.rs` (+1 -0) 📝 `launcher/src/instances.rs` (+62 -0) 📝 `launcher/src/instances/tests.rs` (+45 -8) 📝 `launcher/src/lib.rs` (+1 -0) ➕ `launcher/src/minecraft_versions.rs` (+173 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What and why This is the second piece of Minecraft: Java Edition instances: the instance itself. A player can now make an instance that plays a chosen version of the real game, with its own Java settings. Downloading that version and launching it come in the next PRs. Until then, Play on such an instance says so in a clear sentence. The window's New instance dialog comes with the launcher redesign. ## Changes - **`instances.rs`:** - `Meta` and `Instance` get `java: Option<JavaGame>`, with `minecraft` (the version id) and optionally `home` (a Java home instead of the automatic pick), `memory_mb` (`-Xmx`, default 4 GiB) and `jvm_args`. It is absent from `instances.json` for Horizon instances, so existing files don't change. - `create_java(name, minecraft)` makes the instance with an empty game folder: Horizon's `options.txt` and offline-name file are not copied into the real game. A copy of a Java instance keeps its section. - Play's refusal sits in `Instance::horizon()`, which `resolve_version` and `apply` both call, so the window, the CLI and MCP all show it. - **`minecraft_versions.rs`, new:** Mojang's public `version_manifest_v2.json` from piston-meta, the same list the official launcher reads. - It parses releases, snapshots, old betas and alphas, plus the latest release and snapshot; `find("latest" | "latest-snapshot" | id)`. - The list is kept in `minecraft/` in the data folder, so it shows offline. It is metadata only: the game's files stay behind the owner check in `mojang.rs`. - **CLI:** - `instance create <name> --minecraft <id|latest|latest-snapshot>` - `instance versions [--snapshots] [--old]` - `instance java <instance> [--home <dir>|--auto] [--memory <MiB>] [--args "<jvm args>"]`, refused for Horizon instances - `instance list` (text and `--json`) shows the version. - `launcher/README.md`: the new commands. This is independent of #3386 (Java runtimes): either can merge first. The launch PR joins the two. ## Tested - New tests: `a_java_instance_plays_one_minecraft_version_in_its_own_folder` (empty folder, the entry in `instances.json`, a copy keeps it, Horizon instances unchanged, Play refused, editing memory), plus the version list's parsing and finding, and the kept list showing offline. Existing instance tests are updated for the new argument. - By hand, in fresh `mktemp -d` homes: - `instance versions` listed 26.3 first, and `--old` ended with `rd-132211`. - `instance create Vanilla --minecraft latest` made a 26.3 Java instance. - `instance java Vanilla --memory 6144 --args "-XX:+UseZGC"` was saved. - `instance java Horizon` was refused. - `play --instance Old` (1.12.2) printed the refusal. - The real launcher folder was untouched. - `account::tests::the_whole_chain` fails on the Mac mini only, because a local `node` process (this machine's agent tooling detecting dev servers, user-agent `node`) sends `GET /` to every new localhost port, and that test's mock server logs every request. I confirmed it by logging the stray request's headers. This PR doesn't touch accounts; CI has no such process. The rest of the run: **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at abd1755f9, 3 min 34 s) | Check | Result | | --- | --- | | Scope | ✅ 7 files, +369 −15 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 405 passed (3 min 24 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (3 s) | | launcher clippy | ✅ (1 s) | | launcher tests | ❌ 233 passed, 1 failed (4 s) | | Parity | ➖ 1 affected, to run in CI (--quick): lan_integration | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Label: `feature`. 🤖 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-03 05:09:08 +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#4951
No description provided.