- `--name` leaves OPTIONS: the game still takes it, but the contract doesn't promise offline play. The guide's first step is now the owner rule, and a session the game can't read is stated as a fact, not an option. - A bad value names its option (`Horizon: --width: invalid digit ...`), since a launcher shows that line to the player. - Session errors say "the session", true for --session-stdin too. - --quickPlaySingleplayer takes one folder name of saves/, as vanilla's level id; a path is refused. --world still takes a path for harnesses. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3.5 KiB
Launch API
What another launcher (Prism Launcher, MultiMC, ATLauncher, Modrinth App, HMCL or your own) needs to start Horizon:
the options horizon-client takes, how it hands over an account, and how it ends. horizon-launcher is the
reference implementation. Proposed in horizon-rust/horizon#3545.
Overview
| Version | 0.1.0, printed by horizon-client --launch-api |
| Level | experimental (stability.md): preview once preparing and the guide are covered too |
| Covers | starting horizon-client: its options, the session JSON, the exit codes, the crash report's path |
| Not yet | finding a build, preparing it with horizon-prepare (see Not there yet) |
Guide
-
Start Horizon only for a player signed in with a Microsoft account that owns Minecraft: Java Edition, and hand over that account's session (
--session-stdin, or--session-file), never on the command line. This is the same owner gatehorizon-launcherapplies before every start. Horizon never downloads Mojang's files; a launcher that does downloads them only for that owner. -
Ask the build what it takes:
horizon-client --launch-apiprints JSON withlaunch_api(the version) andoptions. Pass only options it lists: any other is refused with exit code 2. -
Start it with a folder per instance:
horizon-client --resources PREPARED --game-dir INSTANCE --home INSTANCE --width 1280 --height 720 --session-stdin -
Watch the exit code. On 2, stderr names the refused option (
Horizon: --width: …). On 1 or 101, the last line on stderr names the crash report.
Reference
launch-reference.md, generated from crates/horizon-client/src/game/launch_api.rs: every
option, the --launch-api reply and the exit codes.
The session JSON
The account the game joins online-mode servers with (microsoft-account.md):
{"name": "Alex", "uuid": "069a79f444e94726a5befca90e38aaf5", "access_token": "…", "user_type": "msa", "xuid": "…"}
name,uuid(with or without dashes) andaccess_tokenare required;user_type, when present, ismsa;xuidis optional.--session-stdin: write the JSON to the game's standard input and close it.--session-file PATH: a file the game reads once and deletes at once. On Unix its mode must be 0600; a file older than two minutes is refused (and deleted).- A session the game can't read is reported on stderr (
Horizon: not signed in: …), and online-mode servers will refuse the player.
Examples
horizon-client --launch-api
printf '%s' "$SESSION_JSON" | horizon-client --resources ~/horizon/prepared --game-dir ~/instances/a --session-stdin --fullscreen
Stability
Experimental: the options in the reference, the session JSON, the exit codes and the crash report line may still change before preview. From preview on, they change only as stability.md says, and the reference's test keeps the contract and the code together.
Not there yet
- Preparing:
horizon-preparewith--output, explicit inputs (--version-json,--client-jar,--libraries-dir,--assets-dir), one complete preparation,--progress jsonand--check. - Finding a build: a signed release index and builds kept longer than seven days.
- A guide, "Running Horizon from another launcher", from picking a build to playing.
Changelog
- 0.1.0:
--game-dir,--home,--fullscreen,--session-stdin,--launch-api, exit code 2 for a refused command line.