One-click instances and automatic instance switching in Prism #4

Merged
Bewerkt merged 1 commit from claude/minecraft-mod-manager-h5capw into main 2026-10-12 15:45:36 +00:00
Bewerkt commented 2026-10-12 15:42:29 +00:00 (Migrated from github.com)

What changes

One-click instances (server)

  • The pack page leads with "Easiest: download a ready-made instance":

    • GET /pack/<slug>/instance.mrpack for the Modrinth App and Prism Launcher.
    • GET /pack/<slug>/instance-curseforge.zip for the CurseForge app.
  • Each archive contains:

    • the pack's Minecraft version and loader with its version;
    • overrides/mods/managemc.jar;
    • overrides/config/managemc.json, which already holds the pack link.

    The player imports it, presses Play, and ManageMC does the rest. The manual steps stay below as "Or set it up yourself".

  • Loader version: filled in automatically (latest stable from meta.fabricmc.net / maven.neoforged.net) when a pack is created or its Minecraft version or loader changes. The lookup has a 5 s timeout, a 1 h cache, validated values, and never throws. An admin-typed version always wins. The admin UI no longer keeps a stale loader version when the target changes.

  • Other server changes:

    • New dependency-free zipWriter.ts (deterministic output; rejects unsafe entry names).
    • Archives are cached per pack revision.
    • File names come from the slug only.
    • Downloads use the existing rate-limited pack lookup.

Automatic instance switching (mod)

  • When the pack needs another loader or Minecraft version, ManageMC offers to switch:
    • when joining ("Switch and join");
    • after the admin moves the pack to a new version ("Switch instance").
  • Prism Launcher / MultiMC: detected via INST_DIR or the folder layout (mmc-pack.json + instance.cfg).
    • mmc-pack.json is rewritten: the Minecraft and loader components are replaced, other components are kept, and version-bound dependencies are dropped when Minecraft changes so Prism resolves them again. A one-time backup is written as mmc-pack.json.managemc-backup.
    • The mods for the new target are installed right away, and the game closes once.
  • Other launchers: a clear explanation pointing to the ready-made instance.
  • SyncReport now carries the incompatible pack. PackLinker.check reports an incompatibility instead of throwing; the CLI join still refuses it.

Local testing: docker-compose.yml gains build: ., so docker compose up -d --build works without a registry login. The README has a "Trying it locally" section.

Tests

  • Server: 47 tests. New:
    • zip writer round trip, determinism and name checks;
    • NeoForge/Fabric version selection;
    • loader version auto-fill;
    • both archives (manifests, config, jar, headers), the 503s and the 404.
  • Mod: 71 tests. New:
    • Prism detection;
    • loader switch keeps unrelated components;
    • a Minecraft change drops LWJGL;
    • an unknown file is left untouched;
    • the incompatible pack is reported.
  • Manual:
    • Downloaded both archives from a running server and checked their contents.
    • Unpacked the .mrpack as a game folder and ran the mod's sync with the bundled config; it installed all mods without asking.
    • Screenshots of the pack page and of the switch question in the ManageMC window.
  • Not tested here: a real Prism Launcher reading the rewritten mmc-pack.json, and real imports in the Modrinth App and the CurseForge app.

🤖 Generated with Claude Code

https://claude.ai/code/session_016zdMyacgAzBQEBSiHc6aZJ


Generated by Claude Code

## What changes **One-click instances (server)** - The pack page leads with "Easiest: download a ready-made instance": - `GET /pack/<slug>/instance.mrpack` for the Modrinth App and Prism Launcher. - `GET /pack/<slug>/instance-curseforge.zip` for the CurseForge app. - Each archive contains: - the pack's Minecraft version and loader with its version; - `overrides/mods/managemc.jar`; - `overrides/config/managemc.json`, which already holds the pack link. The player imports it, presses Play, and ManageMC does the rest. The manual steps stay below as "Or set it up yourself". - **Loader version:** filled in automatically (latest stable from `meta.fabricmc.net` / `maven.neoforged.net`) when a pack is created or its Minecraft version or loader changes. The lookup has a 5 s timeout, a 1 h cache, validated values, and never throws. An admin-typed version always wins. The admin UI no longer keeps a stale loader version when the target changes. - **Other server changes:** - New dependency-free `zipWriter.ts` (deterministic output; rejects unsafe entry names). - Archives are cached per pack revision. - File names come from the slug only. - Downloads use the existing rate-limited pack lookup. **Automatic instance switching (mod)** - When the pack needs another loader or Minecraft version, ManageMC offers to switch: - when joining ("Switch and join"); - after the admin moves the pack to a new version ("Switch instance"). - **Prism Launcher / MultiMC:** detected via `INST_DIR` or the folder layout (`mmc-pack.json` + `instance.cfg`). - `mmc-pack.json` is rewritten: the Minecraft and loader components are replaced, other components are kept, and version-bound dependencies are dropped when Minecraft changes so Prism resolves them again. A one-time backup is written as `mmc-pack.json.managemc-backup`. - The mods for the new target are installed right away, and the game closes once. - **Other launchers:** a clear explanation pointing to the ready-made instance. - `SyncReport` now carries the incompatible pack. `PackLinker.check` reports an incompatibility instead of throwing; the CLI `join` still refuses it. **Local testing:** `docker-compose.yml` gains `build: .`, so `docker compose up -d --build` works without a registry login. The README has a "Trying it locally" section. ## Tests - Server: 47 tests. New: - zip writer round trip, determinism and name checks; - NeoForge/Fabric version selection; - loader version auto-fill; - both archives (manifests, config, jar, headers), the 503s and the 404. - Mod: 71 tests. New: - Prism detection; - loader switch keeps unrelated components; - a Minecraft change drops LWJGL; - an unknown file is left untouched; - the incompatible pack is reported. - Manual: - Downloaded both archives from a running server and checked their contents. - Unpacked the `.mrpack` as a game folder and ran the mod's sync with the bundled config; it installed all mods without asking. - Screenshots of the pack page and of the switch question in the ManageMC window. - Not tested here: a real Prism Launcher reading the rewritten `mmc-pack.json`, and real imports in the Modrinth App and the CurseForge app. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016zdMyacgAzBQEBSiHc6aZJ --- _Generated by [Claude Code](https://claude.ai/code/session_016zdMyacgAzBQEBSiHc6aZJ)_
Sign in to join this conversation.
No description provided.