[PR #2617] [MERGED] launcher: export an instance as a .mrpack or a zip #4476

Closed
opened 2026-11-03 04:17:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/launcher-export


📝 Commits (1)

  • a9e5214 launcher: export an instance as a .mrpack or a zip

📊 Changes

6 files changed (+593 additions, -0 deletions)

View changed files

📝 docs/launcher-commands.md (+13 -0)
📝 launcher/src/browser/modrinth.rs (+8 -0)
📝 launcher/src/cli.rs (+74 -0)
➕ launcher/src/export.rs (+286 -0)
➕ launcher/src/export/tests.rs (+211 -0)
📝 launcher/src/lib.rs (+1 -0)

📄 Description

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

Clean room: designed from the feature list in briefs/launcher-features-1.md; no other launcher's code, docs or assets were read. The .mrpack layout follows Modrinth's published modpack format.

Launcher features, item 10, part 1: export an instance (or a port) to share. This part is the library, the CLI and MCP. The window's Export… panel is the next PR. Stacked on #2616.

What goes in

  • Settings: options.txt, horizon-graphics.txt, horizon-extras.txt, horizon-controller.txt, horizon-mods.txt, servers.dat.
  • Folders: resourcepacks/, shaderpacks/, horizon-mods/, config/ (dot files skipped).
  • Worlds: only the ones named. Each goes without playerdata/, stats/, advancements/ and session.lock, and its level.dat is rewritten without Data.Player.UUID; the rest of the player data stays.
  • Never: logs, crash reports, screenshots, backups, mod-browser/ caches, mod-browser.json, usercache.json, session.json, horizon-player.txt, telemetry. The list of what goes in is fixed, so a file nobody thought of stays out.

Formats

  • .mrpack: modrinth.index.json (formatVersion 1, game minecraft, dependencies minecraft: 26.3) plus overrides/. A resource pack that the browser installed from Modrinth and that is still the same file (SHA-512 checked) is listed by its download instead of copied. Its URL, SHA-1 and size come from Modrinth's GET /version/{id}, matched on SHA-512. Everything else goes under overrides/.
  • .zip: the game folder's own layout.
  • An instance with nothing to share is refused, rather than written as an empty file.
  • CLI: horizon-launcher instance export [<instance>] [--format mrpack|zip] [--world <w>]… [--out <file>] (default <name>.mrpack in the current folder). The MCP tool instance_export is generated from it.

Proof

  • cargo fmt --check, cargo clippy --all-targets --locked --features gpui/runtime_shaders -- -D warnings: clean. cargo test --locked --features gpui/runtime_shaders --lib --bins: 161 + 36 passed. New tests:
    • a_zip_has_the_instance_and_the_picked_world_and_nothing_private: the exact file list; level.dat keeps XpLevel and loses the UUID; a bad world name and an empty instance are refused.
    • an_mrpack_lists_what_modrinth_serves_and_carries_the_rest: the index fields; a pack edited since its install is carried, not linked; free names.
  • Live run, scratch homes:
    • instance export Hardcore --world "Hardcore 1" gave 15 files in overrides and listed Fresh Animations by its real Modrinth CDN URL, with SHA-1 and SHA-512 from the API.
    • --format zip gave the same files at the root of the zip.
    • An empty port is refused.
  • Import: Horizon's own modpack import currently reads the exported .mrpack as a Java modpack to port. Importing an export back as a Horizon instance is item 11 (drag and drop import), next in the list.

🤖 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/2617 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-export` --- ### 📝 Commits (1) - [`a9e5214`](https://github.com/horizon-rust/horizon/commit/a9e5214ae46d0201ce7c4b026954c986b1e2eac6) launcher: export an instance as a .mrpack or a zip ### 📊 Changes **6 files changed** (+593 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `docs/launcher-commands.md` (+13 -0) 📝 `launcher/src/browser/modrinth.rs` (+8 -0) 📝 `launcher/src/cli.rs` (+74 -0) ➕ `launcher/src/export.rs` (+286 -0) ➕ `launcher/src/export/tests.rs` (+211 -0) 📝 `launcher/src/lib.rs` (+1 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Clean room: designed from the feature list in briefs/launcher-features-1.md; no other launcher's code, docs or assets were read. The .mrpack layout follows Modrinth's published modpack format. Launcher features, item 10, part 1: export an instance (or a port) to share. This part is the library, the CLI and MCP. The window's Export… panel is the next PR. Stacked on #2616. ## What goes in - **Settings:** `options.txt`, `horizon-graphics.txt`, `horizon-extras.txt`, `horizon-controller.txt`, `horizon-mods.txt`, `servers.dat`. - **Folders:** `resourcepacks/`, `shaderpacks/`, `horizon-mods/`, `config/` (dot files skipped). - **Worlds:** only the ones named. Each goes without `playerdata/`, `stats/`, `advancements/` and `session.lock`, and its level.dat is rewritten without `Data.Player.UUID`; the rest of the player data stays. - **Never:** logs, crash reports, screenshots, backups, `mod-browser/` caches, `mod-browser.json`, `usercache.json`, `session.json`, `horizon-player.txt`, telemetry. The list of what goes in is fixed, so a file nobody thought of stays out. ## Formats - **.mrpack:** `modrinth.index.json` (formatVersion 1, game minecraft, dependencies `minecraft: 26.3`) plus `overrides/`. A resource pack that the browser installed from Modrinth and that is still the same file (SHA-512 checked) is listed by its download instead of copied. Its URL, SHA-1 and size come from Modrinth's `GET /version/{id}`, matched on SHA-512. Everything else goes under `overrides/`. - **.zip:** the game folder's own layout. - An instance with nothing to share is refused, rather than written as an empty file. - **CLI:** `horizon-launcher instance export [<instance>] [--format mrpack|zip] [--world <w>]… [--out <file>]` (default `<name>.mrpack` in the current folder). The MCP tool `instance_export` is generated from it. ## Proof - `cargo fmt --check`, `cargo clippy --all-targets --locked --features gpui/runtime_shaders -- -D warnings`: clean. `cargo test --locked --features gpui/runtime_shaders --lib --bins`: 161 + 36 passed. New tests: - `a_zip_has_the_instance_and_the_picked_world_and_nothing_private`: the exact file list; level.dat keeps XpLevel and loses the UUID; a bad world name and an empty instance are refused. - `an_mrpack_lists_what_modrinth_serves_and_carries_the_rest`: the index fields; a pack edited since its install is carried, not linked; free names. - **Live run, scratch homes:** - `instance export Hardcore --world "Hardcore 1"` gave 15 files in overrides and listed Fresh Animations by its real Modrinth CDN URL, with SHA-1 and SHA-512 from the API. - `--format zip` gave the same files at the root of the zip. - An empty port is refused. - **Import:** Horizon's own `modpack import` currently reads the exported .mrpack as a Java modpack to port. Importing an export back as a Horizon instance is item 11 (drag and drop import), next in the list. 🤖 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 04:17:26 +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#4476
No description provided.