[PR #653] [MERGED] horizon-port-pack: a library, fetch and port; CurseForge zips name their mods #2701

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

📋 Pull Request Information

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

Base: main ← Head: feat/port-pack-fetch


📝 Commits (1)

  • ee10460 horizon-port-pack: a library, fetch and port; CurseForge zips name their mods

📊 Changes

8 files changed (+792 additions, -195 deletions)

View changed files

➕ crates/horizon-port-pack/src/fetch.rs (+389 -0)
📝 crates/horizon-port-pack/src/import.rs (+57 -2)
➕ crates/horizon-port-pack/src/lib.rs (+17 -0)
📝 crates/horizon-port-pack/src/main.rs (+70 -187)
📝 crates/horizon-port-pack/src/modrinth.rs (+3 -3)
➕ crates/horizon-port-pack/src/pipeline.rs (+237 -0)
📝 crates/horizon-port-pack/src/report.rs (+1 -1)
📝 docs/modpacks.md (+18 -2)

📄 Description

What

horizon-port-pack becomes a library the launcher can call, with two new steps, so the launcher's "Import modpack" (next PR, stacked) runs the same code as the command line.

  • Library (lib.rs, pipeline.rs): import, inventory, carry and report move out of main.rs and report through a line callback; main.rs is a thin CLI.
  • fetch <work> [--from <folder>] [<mod id>...]: gets the jars of the portable mods (content mods of the data tier, or the ones named) into <work>/jars/. Each jar comes from the player, never from us:
    • copied from a folder they already have (matched by SHA-1, or through a CurseForge app instance's minecraftinstance.json);
    • else downloaded from the link the pack itself gives (a .mrpack's, only on the format's allowed hosts), or the same file on Modrinth's public CDN, found by its SHA-1;
    • kept only when the hash matches. A file only CurseForge has is listed as needing a CurseForge API key (that key is Ludovic's decision), with the player's installed instance as the way round it. <work>/fetch.json records what happened to each file.
  • port <pack> <work> [--from] [--resources]: import, inventory, fetch, the inventory again with the jars read, carry and report, for the portable mods.
  • CurseForge zips name their mods. A manifest lists only project and file ids, which need the key to resolve. When the zip's overrides hold Crash Assistant's config/crash_assistant/modlist.json (All the Mods 10 ships it), its jar names, mod ids and SHA-1s replace the bare ids, so Modrinth can answer for most files.
  • inventory goes on offline (cached answers and the reviewed table) when Modrinth can't be reached, instead of failing.

Why

The brief's working version (docs/modpacks.md, 2026-10-23) has the launcher import a .mrpack or CurseForge zip, show the coverage, port locally and play. The legal rules say the pipeline runs on jars the player downloaded and nothing is redistributed. Modrinth's CDN and the player's own folder do that without a CurseForge key.

Measured on real packs

  • All the Mods 10 8.3, CurseForge zip (downloaded by hand, as a player would): 496 files named from the zip's own mod list. Of the 54 data-tier content mods, 42 download from Modrinth's CDN (84 MB, hash-checked) and 12 are listed as needing the CurseForge key or the player's instance (All the Ores, Pam's crops/trees/food core, Cloud Glass and Factory Blocks in ATM10's CurseForge builds, XTones, ...). 42 carried over. Coverage: 0 ported, 42 partial (the per-mod harness is a dev step), 333 not yet, 121 not needed. 1:13 in total on a loaded Mac mini.
  • A six-mod .mrpack (Macaw's Trapdoors, Fences, Paths, Factory Blocks, Cloud Glass, Glassential Renewed, plus JEI and Sodium; Modrinth's own index with its CDN links): 6 downloaded, 6 carried, and they load and render in the game (screenshots in the launcher PR).

Tests

  • cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings: clean.
  • cargo test -p horizon-port-pack: 21 passed. New: links come from the pack or Modrinth and only from allowed hosts; a CurseForge instance's minecraftinstance.json is read; the player's jars are copied by SHA-1 and by CurseForge id, what only CurseForge has is listed as needing a key, and a rerun finds them in place; a CurseForge zip takes names from its mod list (with the byte order mark Crash Assistant writes).
  • Parity: tools/parity.py --changed origin/main selects 0 of 309 harnesses (no game code changed).

Needs Ludovic

  • A CurseForge API key for the launcher (open question in docs/modpacks.md). Without it, CurseForge-only files come from the player's installed instance.

Nothing in this PR contains mod code or jars; the work folders stay on the player's machine.

🤖 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/653 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/port-pack-fetch` --- ### 📝 Commits (1) - [`ee10460`](https://github.com/horizon-rust/horizon/commit/ee104603dde8ebbe5c86efa939de4259f958fd16) horizon-port-pack: a library, fetch and port; CurseForge zips name their mods ### 📊 Changes **8 files changed** (+792 additions, -195 deletions) <details> <summary>View changed files</summary> ➕ `crates/horizon-port-pack/src/fetch.rs` (+389 -0) 📝 `crates/horizon-port-pack/src/import.rs` (+57 -2) ➕ `crates/horizon-port-pack/src/lib.rs` (+17 -0) 📝 `crates/horizon-port-pack/src/main.rs` (+70 -187) 📝 `crates/horizon-port-pack/src/modrinth.rs` (+3 -3) ➕ `crates/horizon-port-pack/src/pipeline.rs` (+237 -0) 📝 `crates/horizon-port-pack/src/report.rs` (+1 -1) 📝 `docs/modpacks.md` (+18 -2) </details> ### 📄 Description ## What `horizon-port-pack` becomes a library the launcher can call, with two new steps, so the launcher's "Import modpack" (next PR, stacked) runs the same code as the command line. - **Library** (`lib.rs`, `pipeline.rs`): import, inventory, carry and report move out of `main.rs` and report through a line callback; `main.rs` is a thin CLI. - **`fetch <work> [--from <folder>] [<mod id>...]`**: gets the jars of the portable mods (content mods of the data tier, or the ones named) into `<work>/jars/`. Each jar comes from the player, never from us: - copied from a folder they already have (matched by SHA-1, or through a CurseForge app instance's `minecraftinstance.json`); - else downloaded from the link the pack itself gives (a `.mrpack`'s, only on the format's allowed hosts), or the same file on Modrinth's public CDN, found by its SHA-1; - kept only when the hash matches. A file only CurseForge has is listed as **needing a CurseForge API key** (that key is Ludovic's decision), with the player's installed instance as the way round it. `<work>/fetch.json` records what happened to each file. - **`port <pack> <work> [--from] [--resources]`**: import, inventory, fetch, the inventory again with the jars read, carry and report, for the portable mods. - **CurseForge zips name their mods.** A manifest lists only project and file ids, which need the key to resolve. When the zip's overrides hold Crash Assistant's `config/crash_assistant/modlist.json` (All the Mods 10 ships it), its jar names, mod ids and SHA-1s replace the bare ids, so Modrinth can answer for most files. - `inventory` goes on offline (cached answers and the reviewed table) when Modrinth can't be reached, instead of failing. ## Why The brief's working version (docs/modpacks.md, 2026-10-23) has the launcher import a `.mrpack` or CurseForge zip, show the coverage, port locally and play. The legal rules say the pipeline runs on jars the player downloaded and nothing is redistributed. Modrinth's CDN and the player's own folder do that without a CurseForge key. ## Measured on real packs - **All the Mods 10 8.3, CurseForge zip** (downloaded by hand, as a player would): 496 files named from the zip's own mod list. Of the 54 data-tier content mods, 42 download from Modrinth's CDN (84 MB, hash-checked) and 12 are listed as needing the CurseForge key or the player's instance (All the Ores, Pam's crops/trees/food core, Cloud Glass and Factory Blocks in ATM10's CurseForge builds, XTones, ...). 42 carried over. Coverage: 0 ported, 42 partial (the per-mod harness is a dev step), 333 not yet, 121 not needed. 1:13 in total on a loaded Mac mini. - **A six-mod `.mrpack`** (Macaw's Trapdoors, Fences, Paths, Factory Blocks, Cloud Glass, Glassential Renewed, plus JEI and Sodium; Modrinth's own index with its CDN links): 6 downloaded, 6 carried, and they load and render in the game (screenshots in the launcher PR). ## Tests - `cargo fmt --all -- --check`, `cargo clippy --workspace --all-targets -- -D warnings`: clean. - `cargo test -p horizon-port-pack`: 21 passed. New: links come from the pack or Modrinth and only from allowed hosts; a CurseForge instance's `minecraftinstance.json` is read; the player's jars are copied by SHA-1 and by CurseForge id, what only CurseForge has is listed as needing a key, and a rerun finds them in place; a CurseForge zip takes names from its mod list (with the byte order mark Crash Assistant writes). - Parity: `tools/parity.py --changed origin/main` selects 0 of 309 harnesses (no game code changed). ## Needs Ludovic - A CurseForge API key for the launcher (open question in docs/modpacks.md). Without it, CurseForge-only files come from the player's installed instance. Nothing in this PR contains mod code or jars; the work folders stay on the player's machine. 🤖 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:58:23 +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#2701
No description provided.