aether-client-rust 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aether_client_rust-0.2.0/PKG-INFO +91 -0
- aether_client_rust-0.2.0/README.md +78 -0
- aether_client_rust-0.2.0/pyproject.toml +25 -0
- aether_client_rust-0.2.0/setup.cfg +4 -0
- aether_client_rust-0.2.0/src/aether_client/__init__.py +3 -0
- aether_client_rust-0.2.0/src/aether_client/__main__.py +5 -0
- aether_client_rust-0.2.0/src/aether_client/accounts.py +78 -0
- aether_client_rust-0.2.0/src/aether_client/cli.py +84 -0
- aether_client_rust-0.2.0/src/aether_client/core.py +264 -0
- aether_client_rust-0.2.0/src/aether_client_rust.egg-info/PKG-INFO +91 -0
- aether_client_rust-0.2.0/src/aether_client_rust.egg-info/SOURCES.txt +12 -0
- aether_client_rust-0.2.0/src/aether_client_rust.egg-info/dependency_links.txt +1 -0
- aether_client_rust-0.2.0/src/aether_client_rust.egg-info/entry_points.txt +2 -0
- aether_client_rust-0.2.0/src/aether_client_rust.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aether-client-rust
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Launch Horizon (Minecraft Java 26.3 in Rust) offline with local accounts
|
|
5
|
+
Author: Horizon launcher wrapper
|
|
6
|
+
License-Expression: LGPL-3.0-or-later
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Classifier: Operating System :: MacOS
|
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# aether-client
|
|
15
|
+
|
|
16
|
+
Launch Horizon (Minecraft Java 26.3 in Rust) offline from a pip install, with
|
|
17
|
+
local accounts. No Microsoft login, no administrator rights.
|
|
18
|
+
|
|
19
|
+
```bat
|
|
20
|
+
pip install --user aether-client-rust
|
|
21
|
+
aether new_id
|
|
22
|
+
aether accounts
|
|
23
|
+
aether play --n 1
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
On Windows, `%APPDATA%\Python\Python312\Scripts` (or the matching version) must
|
|
27
|
+
be on `PATH` for `aether` to be found. If it isn't, run `python -m aether_client`
|
|
28
|
+
with the same arguments instead.
|
|
29
|
+
|
|
30
|
+
## Commands
|
|
31
|
+
|
|
32
|
+
| Command | What it does |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| `aether new_id [--name NAME]` | Create a local offline account (a name + stable id) |
|
|
35
|
+
| `aether accounts` | List local accounts with their numbers |
|
|
36
|
+
| `aether play --n N` | Start the game as local account number N |
|
|
37
|
+
| `aether play --name Dap` | Play as a name without creating an account |
|
|
38
|
+
| `aether play --dry-run` | Print the launcher command without starting the game |
|
|
39
|
+
| `aether play -- --world MyWorld` | Extra arguments passed to the game |
|
|
40
|
+
| `aether install` | Download binaries now (`--force` replaces them) |
|
|
41
|
+
| `aether status` | Show the data folder and install state |
|
|
42
|
+
| `aether config --manifest URL` | Save the release manifest URL |
|
|
43
|
+
|
|
44
|
+
`aether play` without `--n` uses account 1; if there are no accounts yet, it
|
|
45
|
+
creates one. Accounts live in `accounts.json` in the user data folder — just
|
|
46
|
+
names and ids, no passwords, nothing uploaded.
|
|
47
|
+
|
|
48
|
+
Environment overrides: `MINECRAFT_RUST_MANIFEST` (manifest URL),
|
|
49
|
+
`MINECRAFT_RUST_HOME` (data folder), `MINECRAFT_RUST_BUILD` (Horizon build tag),
|
|
50
|
+
`HORIZON_LAUNCHER_HOME` (use an existing launcher installation).
|
|
51
|
+
|
|
52
|
+
## Release manifest
|
|
53
|
+
|
|
54
|
+
The wheel is a few kilobytes: platform binaries are downloaded on first run
|
|
55
|
+
from the manifest. The default is the public manifest at
|
|
56
|
+
`https://gitlab.com/dapmedia/minecraft-rust-releases/-/raw/main/manifest.json`.
|
|
57
|
+
Point at your own with `config --manifest` or the environment variable. Example
|
|
58
|
+
(`manifest.example.json`):
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"version": "0.1.0",
|
|
63
|
+
"releases": {
|
|
64
|
+
"windows-x86_64": {
|
|
65
|
+
"url": "https://example.com/horizon-windows-x86_64.zip",
|
|
66
|
+
"sha256": "<full sha256 of the archive>",
|
|
67
|
+
"format": "zip",
|
|
68
|
+
"launcher": "horizon-launcher.exe"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Keys are `windows-x86_64`, `windows-arm64`, `macos-x86_64`, `macos-arm64`,
|
|
75
|
+
`linux-x86_64`, `linux-arm64`. SHA-256 is checked before anything is unpacked.
|
|
76
|
+
|
|
77
|
+
## What you still need
|
|
78
|
+
|
|
79
|
+
Horizon ships **no Mojang files**. A fresh PC needs its own copy of Minecraft:
|
|
80
|
+
Java Edition 26.3 and Java 25 so the launcher can prepare resources once (or a
|
|
81
|
+
signed-in Mojang account to download them). After that, offline play needs no
|
|
82
|
+
account and no network.
|
|
83
|
+
|
|
84
|
+
This is not an official Minecraft product and is not approved by or associated
|
|
85
|
+
with Mojang or Microsoft.
|
|
86
|
+
|
|
87
|
+
## Data folders
|
|
88
|
+
|
|
89
|
+
- Windows: `%LOCALAPPDATA%\minecraft-rust`
|
|
90
|
+
- macOS: `~/Library/Application Support/minecraft-rust`
|
|
91
|
+
- Linux: `~/.local/share/minecraft-rust` (or `$XDG_DATA_HOME/minecraft-rust`)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# aether-client
|
|
2
|
+
|
|
3
|
+
Launch Horizon (Minecraft Java 26.3 in Rust) offline from a pip install, with
|
|
4
|
+
local accounts. No Microsoft login, no administrator rights.
|
|
5
|
+
|
|
6
|
+
```bat
|
|
7
|
+
pip install --user aether-client-rust
|
|
8
|
+
aether new_id
|
|
9
|
+
aether accounts
|
|
10
|
+
aether play --n 1
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
On Windows, `%APPDATA%\Python\Python312\Scripts` (or the matching version) must
|
|
14
|
+
be on `PATH` for `aether` to be found. If it isn't, run `python -m aether_client`
|
|
15
|
+
with the same arguments instead.
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
| Command | What it does |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `aether new_id [--name NAME]` | Create a local offline account (a name + stable id) |
|
|
22
|
+
| `aether accounts` | List local accounts with their numbers |
|
|
23
|
+
| `aether play --n N` | Start the game as local account number N |
|
|
24
|
+
| `aether play --name Dap` | Play as a name without creating an account |
|
|
25
|
+
| `aether play --dry-run` | Print the launcher command without starting the game |
|
|
26
|
+
| `aether play -- --world MyWorld` | Extra arguments passed to the game |
|
|
27
|
+
| `aether install` | Download binaries now (`--force` replaces them) |
|
|
28
|
+
| `aether status` | Show the data folder and install state |
|
|
29
|
+
| `aether config --manifest URL` | Save the release manifest URL |
|
|
30
|
+
|
|
31
|
+
`aether play` without `--n` uses account 1; if there are no accounts yet, it
|
|
32
|
+
creates one. Accounts live in `accounts.json` in the user data folder — just
|
|
33
|
+
names and ids, no passwords, nothing uploaded.
|
|
34
|
+
|
|
35
|
+
Environment overrides: `MINECRAFT_RUST_MANIFEST` (manifest URL),
|
|
36
|
+
`MINECRAFT_RUST_HOME` (data folder), `MINECRAFT_RUST_BUILD` (Horizon build tag),
|
|
37
|
+
`HORIZON_LAUNCHER_HOME` (use an existing launcher installation).
|
|
38
|
+
|
|
39
|
+
## Release manifest
|
|
40
|
+
|
|
41
|
+
The wheel is a few kilobytes: platform binaries are downloaded on first run
|
|
42
|
+
from the manifest. The default is the public manifest at
|
|
43
|
+
`https://gitlab.com/dapmedia/minecraft-rust-releases/-/raw/main/manifest.json`.
|
|
44
|
+
Point at your own with `config --manifest` or the environment variable. Example
|
|
45
|
+
(`manifest.example.json`):
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"version": "0.1.0",
|
|
50
|
+
"releases": {
|
|
51
|
+
"windows-x86_64": {
|
|
52
|
+
"url": "https://example.com/horizon-windows-x86_64.zip",
|
|
53
|
+
"sha256": "<full sha256 of the archive>",
|
|
54
|
+
"format": "zip",
|
|
55
|
+
"launcher": "horizon-launcher.exe"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Keys are `windows-x86_64`, `windows-arm64`, `macos-x86_64`, `macos-arm64`,
|
|
62
|
+
`linux-x86_64`, `linux-arm64`. SHA-256 is checked before anything is unpacked.
|
|
63
|
+
|
|
64
|
+
## What you still need
|
|
65
|
+
|
|
66
|
+
Horizon ships **no Mojang files**. A fresh PC needs its own copy of Minecraft:
|
|
67
|
+
Java Edition 26.3 and Java 25 so the launcher can prepare resources once (or a
|
|
68
|
+
signed-in Mojang account to download them). After that, offline play needs no
|
|
69
|
+
account and no network.
|
|
70
|
+
|
|
71
|
+
This is not an official Minecraft product and is not approved by or associated
|
|
72
|
+
with Mojang or Microsoft.
|
|
73
|
+
|
|
74
|
+
## Data folders
|
|
75
|
+
|
|
76
|
+
- Windows: `%LOCALAPPDATA%\minecraft-rust`
|
|
77
|
+
- macOS: `~/Library/Application Support/minecraft-rust`
|
|
78
|
+
- Linux: `~/.local/share/minecraft-rust` (or `$XDG_DATA_HOME/minecraft-rust`)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "aether-client-rust"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Launch Horizon (Minecraft Java 26.3 in Rust) offline with local accounts"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "LGPL-3.0-or-later"
|
|
12
|
+
authors = [{ name = "Horizon launcher wrapper" }]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Operating System :: Microsoft :: Windows",
|
|
16
|
+
"Operating System :: MacOS",
|
|
17
|
+
"Operating System :: POSIX :: Linux",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.scripts]
|
|
21
|
+
aether = "aether_client.cli:main"
|
|
22
|
+
|
|
23
|
+
[tool.setuptools]
|
|
24
|
+
package-dir = { "" = "src" }
|
|
25
|
+
packages = ["aether_client"]
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""Local offline accounts.
|
|
2
|
+
|
|
3
|
+
An account is just a name and a stable id kept in the user data folder. No
|
|
4
|
+
Microsoft login, no password, nothing uploaded. `aether play --n N` selects one
|
|
5
|
+
of these; `aether new_id` adds another.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import random
|
|
10
|
+
import string
|
|
11
|
+
import uuid
|
|
12
|
+
|
|
13
|
+
from .core import Error, data_dir
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def accounts_path():
|
|
17
|
+
return data_dir() / "accounts.json"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def load() -> list[dict]:
|
|
21
|
+
path = accounts_path()
|
|
22
|
+
if not path.is_file():
|
|
23
|
+
return []
|
|
24
|
+
try:
|
|
25
|
+
accounts = json.loads(path.read_text(encoding="utf-8"))
|
|
26
|
+
except (ValueError, OSError) as exc:
|
|
27
|
+
raise Error(f"Could not read local accounts: {exc}") from exc
|
|
28
|
+
if not isinstance(accounts, list):
|
|
29
|
+
raise Error("The local accounts file is not a list.")
|
|
30
|
+
return accounts
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def save(accounts: list[dict]) -> None:
|
|
34
|
+
data_dir().mkdir(parents=True, exist_ok=True)
|
|
35
|
+
accounts_path().write_text(json.dumps(accounts, indent=2) + "\n", encoding="utf-8")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def default_name() -> str:
|
|
39
|
+
"""A short, valid player name, e.g. Aether48291."""
|
|
40
|
+
return "Aether" + "".join(random.choices(string.digits, k=5))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def new_id(name: str | None = None) -> dict:
|
|
44
|
+
accounts = load()
|
|
45
|
+
entry = {
|
|
46
|
+
"name": (name or default_name()).strip(),
|
|
47
|
+
"uuid": str(uuid.uuid4()),
|
|
48
|
+
}
|
|
49
|
+
if not entry["name"]:
|
|
50
|
+
raise Error("An account name cannot be empty.")
|
|
51
|
+
accounts.append(entry)
|
|
52
|
+
save(accounts)
|
|
53
|
+
return entry
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def pick(number: int | None = None) -> dict:
|
|
57
|
+
"""The numbered account, 1-based. With no accounts, create the first one."""
|
|
58
|
+
accounts = load()
|
|
59
|
+
if not accounts:
|
|
60
|
+
return new_id()
|
|
61
|
+
if number is None:
|
|
62
|
+
number = 1
|
|
63
|
+
if not 1 <= number <= len(accounts):
|
|
64
|
+
raise Error(
|
|
65
|
+
f"No account number {number}. You have {len(accounts)}; see `aether accounts`."
|
|
66
|
+
)
|
|
67
|
+
return accounts[number - 1]
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def listing() -> str:
|
|
71
|
+
accounts = load()
|
|
72
|
+
if not accounts:
|
|
73
|
+
return "No local accounts yet. Run `aether new_id` to make one."
|
|
74
|
+
lines = []
|
|
75
|
+
for index, account in enumerate(accounts, 1):
|
|
76
|
+
short = str(account.get("uuid", ""))[:8]
|
|
77
|
+
lines.append(f"{index}: {account.get('name', '?')} ({short})")
|
|
78
|
+
return "\n".join(lines)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""The ``aether`` command-line interface."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
from . import __version__, accounts, core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _play(args: argparse.Namespace) -> int:
|
|
12
|
+
if args.name:
|
|
13
|
+
name = args.name
|
|
14
|
+
else:
|
|
15
|
+
name = accounts.pick(args.n)["name"]
|
|
16
|
+
command, extra_env = core.play_command(name, args.build, args.extra)
|
|
17
|
+
if args.dry_run:
|
|
18
|
+
print(" ".join(command))
|
|
19
|
+
return 0
|
|
20
|
+
env = os.environ.copy()
|
|
21
|
+
env.update(extra_env)
|
|
22
|
+
try:
|
|
23
|
+
return subprocess.run(command, env=env).returncode
|
|
24
|
+
except OSError as exc:
|
|
25
|
+
print(f"Could not start the game: {exc}", file=sys.stderr)
|
|
26
|
+
return 1
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _accounts(args: argparse.Namespace) -> int:
|
|
30
|
+
print(accounts.listing())
|
|
31
|
+
return 0
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _new_id(args: argparse.Namespace) -> int:
|
|
35
|
+
entry = accounts.new_id(args.name)
|
|
36
|
+
number = len(accounts.load())
|
|
37
|
+
print(f"{number}: {entry['name']} ({entry['uuid'][:8]})")
|
|
38
|
+
return 0
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def main(argv: list[str] | None = None) -> int:
|
|
42
|
+
parser = argparse.ArgumentParser(
|
|
43
|
+
prog="aether",
|
|
44
|
+
description="Launch Horizon (Minecraft Java 26.3 in Rust) offline, with local accounts.",
|
|
45
|
+
)
|
|
46
|
+
parser.add_argument("--version", action="version", version=f"aether {__version__}")
|
|
47
|
+
commands = parser.add_subparsers(dest="command", required=True)
|
|
48
|
+
|
|
49
|
+
play = commands.add_parser("play", help="Start the game (downloads binaries on first run)")
|
|
50
|
+
play.add_argument("--n", type=int, help="Local account number to play as (see `aether accounts`)")
|
|
51
|
+
play.add_argument("--name", help="Play as this name instead of a numbered account")
|
|
52
|
+
play.add_argument("--build", help="Installed Horizon build to play (default: the newest)")
|
|
53
|
+
play.add_argument("--dry-run", action="store_true", help="Print the command instead of starting")
|
|
54
|
+
play.add_argument("extra", nargs=argparse.REMAINDER, help="Extra arguments for the game")
|
|
55
|
+
play.set_defaults(handler=_play)
|
|
56
|
+
|
|
57
|
+
listing = commands.add_parser("accounts", help="List local accounts for offline play")
|
|
58
|
+
listing.set_defaults(handler=_accounts)
|
|
59
|
+
|
|
60
|
+
new = commands.add_parser("new_id", help="Create a new local offline account")
|
|
61
|
+
new.add_argument("--name", help="Account name (default: a generated Aether name)")
|
|
62
|
+
new.set_defaults(handler=_new_id)
|
|
63
|
+
|
|
64
|
+
install = commands.add_parser("install", help="Download this platform's binaries")
|
|
65
|
+
install.add_argument("--force", action="store_true", help="Replace an existing install")
|
|
66
|
+
install.set_defaults(handler=lambda args: print(f"Installed: {core.install(args.force)['url']}") or 0)
|
|
67
|
+
|
|
68
|
+
status = commands.add_parser("status", help="Show the install state")
|
|
69
|
+
status.set_defaults(handler=lambda args: print(core.status()) or 0)
|
|
70
|
+
|
|
71
|
+
config = commands.add_parser("config", help="Set the release manifest URL")
|
|
72
|
+
config.add_argument("--manifest", required=True, help="HTTP(S) URL of a release manifest")
|
|
73
|
+
config.set_defaults(
|
|
74
|
+
handler=lambda args: (core.save_manifest_url(args.manifest), print(f"Manifest: {args.manifest}"))[1] * 0
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
args = parser.parse_args(argv)
|
|
78
|
+
try:
|
|
79
|
+
return int(args.handler(args) or 0)
|
|
80
|
+
except core.Error as exc:
|
|
81
|
+
print(f"aether: {exc}", file=sys.stderr)
|
|
82
|
+
return 1
|
|
83
|
+
except KeyboardInterrupt:
|
|
84
|
+
return 130
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"""Paths, first-run binary download and the offline play command.
|
|
2
|
+
|
|
3
|
+
Nothing here needs administrator rights: every file lives under the user's own
|
|
4
|
+
data folder. The launcher binary and game build are downloaded once from the
|
|
5
|
+
manifest at ``MINECRAFT_RUST_MANIFEST`` (or the one saved with ``config``).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import hashlib
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
import platform
|
|
12
|
+
import re
|
|
13
|
+
import shutil
|
|
14
|
+
import sys
|
|
15
|
+
import tarfile
|
|
16
|
+
import tempfile
|
|
17
|
+
import urllib.request
|
|
18
|
+
import zipfile
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
DEFAULT_MANIFEST = (
|
|
22
|
+
"https://gitlab.com/dapmedia/minecraft-rust-releases/-/raw/main/manifest.json"
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Error(Exception):
|
|
27
|
+
"""A problem to show to the player, without a traceback."""
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def data_dir() -> Path:
|
|
31
|
+
"""User-writable folder for the downloaded binaries and settings."""
|
|
32
|
+
override = os.environ.get("MINECRAFT_RUST_HOME")
|
|
33
|
+
if override:
|
|
34
|
+
return Path(override).expanduser()
|
|
35
|
+
if sys.platform == "win32":
|
|
36
|
+
return Path(os.environ.get("LOCALAPPDATA", Path.home() / "AppData" / "Local")) / "minecraft-rust"
|
|
37
|
+
if sys.platform == "darwin":
|
|
38
|
+
return Path.home() / "Library" / "Application Support" / "minecraft-rust"
|
|
39
|
+
return Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local" / "share")) / "minecraft-rust"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def config_path() -> Path:
|
|
43
|
+
return data_dir() / "config.json"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def installed_path() -> Path:
|
|
47
|
+
return data_dir() / "installed.json"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def app_dir() -> Path:
|
|
51
|
+
return data_dir() / "app"
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def launcher_data_dir() -> Path | None:
|
|
55
|
+
"""The launcher's data folder, when the player chose one explicitly."""
|
|
56
|
+
value = os.environ.get("HORIZON_LAUNCHER_HOME")
|
|
57
|
+
return Path(value).expanduser() if value else None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def manifest_url() -> str:
|
|
61
|
+
value = os.environ.get("MINECRAFT_RUST_MANIFEST")
|
|
62
|
+
if value:
|
|
63
|
+
return value
|
|
64
|
+
if config_path().is_file():
|
|
65
|
+
saved = json.loads(config_path().read_text(encoding="utf-8")).get("manifest")
|
|
66
|
+
if saved:
|
|
67
|
+
return saved
|
|
68
|
+
return DEFAULT_MANIFEST
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def save_manifest_url(url: str) -> None:
|
|
72
|
+
data_dir().mkdir(parents=True, exist_ok=True)
|
|
73
|
+
config_path().write_text(json.dumps({"manifest": url}, indent=2), encoding="utf-8")
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def platform_key() -> str:
|
|
77
|
+
system = platform.system().lower()
|
|
78
|
+
machine = platform.machine().lower()
|
|
79
|
+
arch = "arm64" if machine in {"arm64", "aarch64"} else "x86_64"
|
|
80
|
+
if system == "windows":
|
|
81
|
+
return f"windows-{arch}"
|
|
82
|
+
if system == "darwin":
|
|
83
|
+
return f"macos-{arch}"
|
|
84
|
+
if system == "linux":
|
|
85
|
+
return f"linux-{arch}"
|
|
86
|
+
raise Error(f"No builds are published for {system} {machine}.")
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def load_manifest() -> dict:
|
|
90
|
+
url = manifest_url()
|
|
91
|
+
try:
|
|
92
|
+
with urllib.request.urlopen(url, timeout=30) as response:
|
|
93
|
+
manifest = json.load(response)
|
|
94
|
+
except Exception as exc:
|
|
95
|
+
raise Error(
|
|
96
|
+
f"Could not read the release manifest at {url}: {exc}\n"
|
|
97
|
+
"Set MINECRAFT_RUST_MANIFEST (or `minecraft-rust config --manifest URL`) "
|
|
98
|
+
"to a manifest you control."
|
|
99
|
+
) from exc
|
|
100
|
+
entry = manifest.get("releases", {}).get(platform_key())
|
|
101
|
+
if not entry:
|
|
102
|
+
raise Error(f"The manifest has no build for {platform_key()}.")
|
|
103
|
+
return entry
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def _sha256(path: Path) -> str:
|
|
107
|
+
digest = hashlib.sha256()
|
|
108
|
+
with path.open("rb") as stream:
|
|
109
|
+
for chunk in iter(lambda: stream.read(1024 * 1024), b""):
|
|
110
|
+
digest.update(chunk)
|
|
111
|
+
return digest.hexdigest()
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _safe_extract(archive: Path, target: Path, fmt: str) -> None:
|
|
115
|
+
"""Extract an archive without letting it write outside ``target``."""
|
|
116
|
+
target.mkdir(parents=True, exist_ok=True)
|
|
117
|
+
root = target.resolve()
|
|
118
|
+
if fmt == "zip":
|
|
119
|
+
with zipfile.ZipFile(archive) as zf:
|
|
120
|
+
for info in zf.infolist():
|
|
121
|
+
dest = (target / info.filename).resolve()
|
|
122
|
+
if not dest.is_relative_to(root):
|
|
123
|
+
raise Error(f"Unsafe path in the archive: {info.filename}")
|
|
124
|
+
zf.extract(info, target)
|
|
125
|
+
elif fmt in ("tar.gz", "tgz", "tar.xz", "txz"):
|
|
126
|
+
with tarfile.open(archive, f"r:{fmt.replace('tgz', 'gz').replace('txz', 'xz')}") as tf:
|
|
127
|
+
for member in tf.getmembers():
|
|
128
|
+
dest = (target / member.name).resolve()
|
|
129
|
+
if not dest.is_relative_to(root):
|
|
130
|
+
raise Error(f"Unsafe path in the archive: {member.name}")
|
|
131
|
+
tf.extract(member, target)
|
|
132
|
+
else:
|
|
133
|
+
raise Error(f"Unsupported archive format {fmt!r} in the manifest.")
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def install(force: bool = False) -> dict:
|
|
137
|
+
"""Download and unpack this platform's binaries once."""
|
|
138
|
+
marker = installed_path()
|
|
139
|
+
if marker.is_file() and not force:
|
|
140
|
+
state = json.loads(marker.read_text(encoding="utf-8"))
|
|
141
|
+
executable = app_dir() / state["launcher"]
|
|
142
|
+
if executable.is_file():
|
|
143
|
+
return state
|
|
144
|
+
entry = load_manifest()
|
|
145
|
+
url = entry["url"]
|
|
146
|
+
fmt = entry.get("format", url.rsplit(".", 1)[-1])
|
|
147
|
+
expected = entry.get("sha256")
|
|
148
|
+
with tempfile.TemporaryDirectory(prefix="minecraft-rust-") as scratch:
|
|
149
|
+
archive = Path(scratch) / f"download.{fmt}"
|
|
150
|
+
try:
|
|
151
|
+
with urllib.request.urlopen(url, timeout=60) as response, archive.open("wb") as out:
|
|
152
|
+
shutil.copyfileobj(response, out)
|
|
153
|
+
except Exception as exc:
|
|
154
|
+
raise Error(f"Could not download {url}: {exc}") from exc
|
|
155
|
+
if expected and _sha256(archive) != expected.lower():
|
|
156
|
+
raise Error(f"The download from {url} failed its SHA-256 check.")
|
|
157
|
+
destination = app_dir()
|
|
158
|
+
if force and destination.exists():
|
|
159
|
+
shutil.rmtree(destination)
|
|
160
|
+
_safe_extract(archive, destination, fmt)
|
|
161
|
+
launcher = app_dir() / entry.get("launcher", "horizon-launcher.exe" if os.name == "nt" else "horizon-launcher")
|
|
162
|
+
if not launcher.is_file():
|
|
163
|
+
raise Error(f"The downloaded build has no launcher at {launcher}.")
|
|
164
|
+
state = {
|
|
165
|
+
"platform": platform_key(),
|
|
166
|
+
"launcher": str(launcher.relative_to(app_dir())),
|
|
167
|
+
"manifest": manifest_url(),
|
|
168
|
+
"url": url,
|
|
169
|
+
}
|
|
170
|
+
data_dir().mkdir(parents=True, exist_ok=True)
|
|
171
|
+
marker.write_text(json.dumps(state, indent=2), encoding="utf-8")
|
|
172
|
+
return state
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def launcher_command() -> list[str]:
|
|
176
|
+
state = install()
|
|
177
|
+
return [str(app_dir() / state["launcher"])]
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def _run(arguments: list[str], env: dict | None = None) -> str:
|
|
181
|
+
import subprocess
|
|
182
|
+
|
|
183
|
+
merged = os.environ.copy()
|
|
184
|
+
if env:
|
|
185
|
+
merged.update(env)
|
|
186
|
+
try:
|
|
187
|
+
result = subprocess.run(arguments, capture_output=True, text=True, env=merged)
|
|
188
|
+
except OSError as exc:
|
|
189
|
+
raise Error(f"Could not start {arguments[0]}: {exc}") from exc
|
|
190
|
+
if result.returncode != 0:
|
|
191
|
+
detail = (result.stderr or result.stdout).strip()
|
|
192
|
+
raise Error(detail or f"{arguments[0]} exited with {result.returncode}.")
|
|
193
|
+
return result.stdout
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def installed_versions(launcher: list[str]) -> list[str]:
|
|
197
|
+
try:
|
|
198
|
+
answer = json.loads(_run(launcher + ["versions", "--installed", "--json"]))
|
|
199
|
+
except (ValueError, Error):
|
|
200
|
+
return []
|
|
201
|
+
return answer.get("installed", [])
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def choose_build(launcher: list[str], requested: str | None) -> str:
|
|
205
|
+
if requested:
|
|
206
|
+
return requested
|
|
207
|
+
env = os.environ.get("MINECRAFT_RUST_BUILD")
|
|
208
|
+
if env:
|
|
209
|
+
return env
|
|
210
|
+
builds = [tag for tag in installed_versions(launcher) if not tag.startswith("offline-")]
|
|
211
|
+
if not builds:
|
|
212
|
+
raise Error(
|
|
213
|
+
"No Horizon build is installed. Install one with the Horizon launcher "
|
|
214
|
+
"first, or set MINECRAFT_RUST_BUILD to its tag."
|
|
215
|
+
)
|
|
216
|
+
return builds[0]
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def offline_tag(name: str) -> str:
|
|
220
|
+
safe = re.sub(r"[^A-Za-z0-9_.-]+", "-", name).strip("-").lower() or "player"
|
|
221
|
+
return "offline-" + safe
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def play_command(name: str, build: str | None = None, extra: list[str] | None = None) -> tuple[list[str], dict]:
|
|
225
|
+
"""The command that starts the account-free Rust game as ``name``."""
|
|
226
|
+
launcher = launcher_command()
|
|
227
|
+
base = choose_build(launcher, build)
|
|
228
|
+
tag = offline_tag(name)
|
|
229
|
+
if tag not in installed_versions(launcher):
|
|
230
|
+
_run(
|
|
231
|
+
launcher
|
|
232
|
+
+ [
|
|
233
|
+
"offline-version",
|
|
234
|
+
"--name",
|
|
235
|
+
tag,
|
|
236
|
+
"--horizon",
|
|
237
|
+
base,
|
|
238
|
+
"--username",
|
|
239
|
+
name,
|
|
240
|
+
"--json",
|
|
241
|
+
]
|
|
242
|
+
)
|
|
243
|
+
command = launcher + ["play", "--version", tag] + (extra or [])
|
|
244
|
+
env: dict[str, str] = {}
|
|
245
|
+
home = launcher_data_dir()
|
|
246
|
+
if home:
|
|
247
|
+
env["HORIZON_LAUNCHER_HOME"] = str(home)
|
|
248
|
+
return command, env
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def status() -> str:
|
|
252
|
+
lines = [
|
|
253
|
+
f"data folder: {data_dir()}",
|
|
254
|
+
f"manifest: {manifest_url()}",
|
|
255
|
+
f"platform: {platform_key()}",
|
|
256
|
+
]
|
|
257
|
+
marker = installed_path()
|
|
258
|
+
if marker.is_file():
|
|
259
|
+
state = json.loads(marker.read_text(encoding="utf-8"))
|
|
260
|
+
launcher = app_dir() / state["launcher"]
|
|
261
|
+
lines.append(f"binaries: {launcher} ({'ready' if launcher.is_file() else 'missing'})")
|
|
262
|
+
else:
|
|
263
|
+
lines.append("binaries: not installed (run `minecraft-rust install`)")
|
|
264
|
+
return "\n".join(lines)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aether-client-rust
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Launch Horizon (Minecraft Java 26.3 in Rust) offline with local accounts
|
|
5
|
+
Author: Horizon launcher wrapper
|
|
6
|
+
License-Expression: LGPL-3.0-or-later
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
9
|
+
Classifier: Operating System :: MacOS
|
|
10
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# aether-client
|
|
15
|
+
|
|
16
|
+
Launch Horizon (Minecraft Java 26.3 in Rust) offline from a pip install, with
|
|
17
|
+
local accounts. No Microsoft login, no administrator rights.
|
|
18
|
+
|
|
19
|
+
```bat
|
|
20
|
+
pip install --user aether-client-rust
|
|
21
|
+
aether new_id
|
|
22
|
+
aether accounts
|
|
23
|
+
aether play --n 1
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
On Windows, `%APPDATA%\Python\Python312\Scripts` (or the matching version) must
|
|
27
|
+
be on `PATH` for `aether` to be found. If it isn't, run `python -m aether_client`
|
|
28
|
+
with the same arguments instead.
|
|
29
|
+
|
|
30
|
+
## Commands
|
|
31
|
+
|
|
32
|
+
| Command | What it does |
|
|
33
|
+
| --- | --- |
|
|
34
|
+
| `aether new_id [--name NAME]` | Create a local offline account (a name + stable id) |
|
|
35
|
+
| `aether accounts` | List local accounts with their numbers |
|
|
36
|
+
| `aether play --n N` | Start the game as local account number N |
|
|
37
|
+
| `aether play --name Dap` | Play as a name without creating an account |
|
|
38
|
+
| `aether play --dry-run` | Print the launcher command without starting the game |
|
|
39
|
+
| `aether play -- --world MyWorld` | Extra arguments passed to the game |
|
|
40
|
+
| `aether install` | Download binaries now (`--force` replaces them) |
|
|
41
|
+
| `aether status` | Show the data folder and install state |
|
|
42
|
+
| `aether config --manifest URL` | Save the release manifest URL |
|
|
43
|
+
|
|
44
|
+
`aether play` without `--n` uses account 1; if there are no accounts yet, it
|
|
45
|
+
creates one. Accounts live in `accounts.json` in the user data folder — just
|
|
46
|
+
names and ids, no passwords, nothing uploaded.
|
|
47
|
+
|
|
48
|
+
Environment overrides: `MINECRAFT_RUST_MANIFEST` (manifest URL),
|
|
49
|
+
`MINECRAFT_RUST_HOME` (data folder), `MINECRAFT_RUST_BUILD` (Horizon build tag),
|
|
50
|
+
`HORIZON_LAUNCHER_HOME` (use an existing launcher installation).
|
|
51
|
+
|
|
52
|
+
## Release manifest
|
|
53
|
+
|
|
54
|
+
The wheel is a few kilobytes: platform binaries are downloaded on first run
|
|
55
|
+
from the manifest. The default is the public manifest at
|
|
56
|
+
`https://gitlab.com/dapmedia/minecraft-rust-releases/-/raw/main/manifest.json`.
|
|
57
|
+
Point at your own with `config --manifest` or the environment variable. Example
|
|
58
|
+
(`manifest.example.json`):
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"version": "0.1.0",
|
|
63
|
+
"releases": {
|
|
64
|
+
"windows-x86_64": {
|
|
65
|
+
"url": "https://example.com/horizon-windows-x86_64.zip",
|
|
66
|
+
"sha256": "<full sha256 of the archive>",
|
|
67
|
+
"format": "zip",
|
|
68
|
+
"launcher": "horizon-launcher.exe"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Keys are `windows-x86_64`, `windows-arm64`, `macos-x86_64`, `macos-arm64`,
|
|
75
|
+
`linux-x86_64`, `linux-arm64`. SHA-256 is checked before anything is unpacked.
|
|
76
|
+
|
|
77
|
+
## What you still need
|
|
78
|
+
|
|
79
|
+
Horizon ships **no Mojang files**. A fresh PC needs its own copy of Minecraft:
|
|
80
|
+
Java Edition 26.3 and Java 25 so the launcher can prepare resources once (or a
|
|
81
|
+
signed-in Mojang account to download them). After that, offline play needs no
|
|
82
|
+
account and no network.
|
|
83
|
+
|
|
84
|
+
This is not an official Minecraft product and is not approved by or associated
|
|
85
|
+
with Mojang or Microsoft.
|
|
86
|
+
|
|
87
|
+
## Data folders
|
|
88
|
+
|
|
89
|
+
- Windows: `%LOCALAPPDATA%\minecraft-rust`
|
|
90
|
+
- macOS: `~/Library/Application Support/minecraft-rust`
|
|
91
|
+
- Linux: `~/.local/share/minecraft-rust` (or `$XDG_DATA_HOME/minecraft-rust`)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/aether_client/__init__.py
|
|
4
|
+
src/aether_client/__main__.py
|
|
5
|
+
src/aether_client/accounts.py
|
|
6
|
+
src/aether_client/cli.py
|
|
7
|
+
src/aether_client/core.py
|
|
8
|
+
src/aether_client_rust.egg-info/PKG-INFO
|
|
9
|
+
src/aether_client_rust.egg-info/SOURCES.txt
|
|
10
|
+
src/aether_client_rust.egg-info/dependency_links.txt
|
|
11
|
+
src/aether_client_rust.egg-info/entry_points.txt
|
|
12
|
+
src/aether_client_rust.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aether_client
|