Merge branch 'main' into parity-base

# Conflicts:
#	README.md
#	crates/horizon-client/src/game.rs
This commit is contained in:
Ludovic Marie
2026-10-12 19:02:09 +02:00
32 changed files with 883 additions and 581 deletions
+22 -15
View File
@@ -8,12 +8,7 @@ permissions:
contents: read
jobs:
verify:
strategy:
fail-fast: false
matrix:
# Linux only. macOS only when started by hand: gh workflow run checks --ref <branch>.
os: ${{ fromJSON(github.event_name == 'workflow_dispatch' && '["ubuntu-latest", "macos-26"]' || '["ubuntu-latest"]') }}
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
@@ -27,14 +22,30 @@ jobs:
python tools/check_public_tree.py --history
- name: Test offline research tooling
run: python -m unittest discover -s tests -v
- name: Install Rust toolchain
run: rustup toolchain install stable --profile minimal --component rustfmt --component clippy
- name: Install Rust toolchain and the ALSA headers the client's audio links against
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends libasound2-dev
rustup toolchain install stable --profile minimal --component rustfmt --component clippy
- name: Check formatting and lint
run: |
cargo +stable fmt --all -- --check
cargo +stable clippy --workspace --all-targets -- -D warnings
- name: Test Rust core and voxel kernel correctness
run: cargo +stable test --workspace
# Horizon never downloads the game. These jobs need a self-hosted Linux runner
# (label horizon-game) holding the maintainer's own copy: the official launcher's
# game directory in HORIZON_MINECRAFT_DIR and the pinned server jar in
# HORIZON_SERVER_JAR. Start them by hand: gh workflow run checks --ref <branch>.
vanilla-parity:
if: github.event_name == 'workflow_dispatch'
runs-on: [self-hosted, linux, horizon-game]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Rust toolchain
run: rustup toolchain install stable --profile minimal
- uses: actions/setup-java@v4
with:
distribution: temurin
@@ -374,12 +385,8 @@ jobs:
RUSTUP_TOOLCHAIN: stable
run: python tools/test_float_log_parity.py
portable-mod:
strategy:
fail-fast: false
matrix:
# Linux only. macOS only when started by hand: gh workflow run checks --ref <branch>.
os: ${{ fromJSON(github.event_name == 'workflow_dispatch' && '["ubuntu-latest", "macos-26"]' || '["ubuntu-latest"]') }}
runs-on: ${{ matrix.os }}
if: github.event_name == 'workflow_dispatch'
runs-on: [self-hosted, linux, horizon-game]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
@@ -466,7 +473,7 @@ jobs:
- name: Upload original mod and pack manifests only
uses: actions/upload-artifact@v4
with:
name: horizon-${{ matrix.os }}
name: horizon-linux
path: |
dist/*.mrpack
dist/horizon-*.jar
+129 -287
View File
@@ -1,13 +1,65 @@
<p align="center">
<img src="docs/media/banner.jpg" alt="Horizon: Minecraft Java Edition 26.3, rewritten from scratch in Rust" width="100%">
</p>
<p align="center">
<a href="https://github.com/ludovic111/horizon/actions/workflows/ci.yml"><img src="https://github.com/ludovic111/horizon/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
<img src="https://img.shields.io/badge/Minecraft-Java%2026.3-5D9C3F" alt="Minecraft Java 26.3">
<img src="https://img.shields.io/badge/Rust-stable-B7410E?logo=rust&logoColor=white" alt="Rust">
<img src="https://img.shields.io/badge/vanilla%20parity-88%25-F0795A" alt="Vanilla parity 88%">
<img src="https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-2A2470" alt="Linux, macOS and Windows">
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-3B2F7E" alt="MIT license"></a>
</p>
<p align="center">
<a href="#getting-it"><b>Get started</b></a> ·
<a href="#screenshots"><b>Screenshots</b></a> ·
<a href="#project-status"><b>Parity status</b></a> ·
<a href="docs/native-client.md"><b>Native client guide</b></a>
</p>
# Horizon
Horizon is a Rust rewrite of Minecraft Java **26.3** targeting one-to-one vanilla gameplay parity, alongside client performance research. Not affiliated with Mojang or Microsoft.
A Rust rewrite of Minecraft: Java Edition 26.3 that aims for one-to-one vanilla parity, checked against the game itself with differential tests.
**Status:** in development. The native client is playable on Linux, macOS (Apple Silicon) and Windows; Java parity is 88% (see [Project status](#project-status)).
> Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft. Horizon contains no Minecraft code, assets or data: you need your own legally obtained copy of Minecraft: Java Edition 26.3.
## Screenshots
Captured in the Rust client itself, with vanilla assets and no mods or shaders.
<table>
<tr>
<td colspan="2"><img src="docs/media/sunset.jpg" alt="Sunset over a savanna river valley and a plains village"></td>
</tr>
<tr>
<td width="50%"><img src="docs/media/village.jpg" alt="A plains village with farms, an iron golem and animals"></td>
<td width="50%"><img src="docs/media/survival.jpg" alt="Survival at dusk: a zombie attacks near the village"></td>
</tr>
<tr>
<td width="50%"><img src="docs/media/nether.jpg" alt="A crimson forest in the Nether with a zombified piglin"></td>
<td width="50%"><img src="docs/media/night.jpg" alt="Moonrise over a torch-lit village and river"></td>
</tr>
<tr>
<td width="50%"><img src="docs/media/underwater.jpg" alt="Salmon swimming in a river"></td>
<td width="50%" valign="middle">
Vanilla world generation ported to Rust (terrain, aquifers, carvers, features, villages and the Nether), every block model with smooth lighting and biome tints, the vanilla sky and fog, mobs, the HUD, chat and advancements: everything in these frames is drawn by Horizon.
</td>
</tr>
</table>
## What it does
Horizon reimplements the Minecraft Java client and its game logic in Rust, one subsystem at a time, and compares each piece with the vanilla game. Each `tools/test_*_parity.py` harness drives the same inputs through Horizon and through the vanilla client and server bytecode from your own copy of the game, then checks that the outputs are identical. It is for players and developers interested in game reimplementation, and for anyone who wants to see how far a behaviour-exact native rewrite can go.
The [native client](docs/native-client.md) opens on a vanilla-style title screen with world creation and selection, and generates worlds with the Rust port of the vanilla generators: noise terrain, aquifers, surface rules, carvers and placed features, all checked against vanilla. It streams and lights chunks on worker threads and renders every vanilla block model with smooth lighting, biome tints, the vanilla sky, sun, moon, stars and clouds. Gameplay includes:
**The Rust game is now playable.** The [native client](docs/native-client.md) opens on a vanilla-style title screen with world creation and selection, and generates worlds with the Rust port of the vanilla overworld generator: noise terrain, aquifers, surface rules, carvers, and the placed features ported so far, all checked against vanilla. It streams and lights chunks on worker threads and renders every vanilla block model with smooth lighting, biome tints, the vanilla sky, sun, moon, stars and clouds. Gameplay so far:
- validated player physics, health and hunger;
- mining with vanilla tool rules and loot tables;
- placing, crafting, chests and furnaces;
- dropped items and particles;
- sounds;
- dropped items, particles and sounds;
- passive and hostile mobs with combat and vanilla AI, including guardians, shulkers, illagers, ravagers, the wither, the ender dragon fight, the breeze, the creaking, the sniffer, the happy ghast, llamas and the copper golem;
- villagers that take jobs, trade, restock, meet at the bell and sleep in beds, on a port of vanilla's brain;
- raids and pillager patrols;
@@ -15,9 +67,51 @@ Horizon is a Rust rewrite of Minecraft Java **26.3** targeting one-to-one vanill
- every command, scoreboards and teams, the player list, subtitles and the HUD overlays;
- boats, minecarts, item frames, paintings and armor stands;
- shields, maps, books, fireworks, beacons, advancements and statistics;
- Anvil saves.
- Anvil saves, joining vanilla servers, and opening a world to LAN.
Parity is **not** complete. Still missing: the warden's brain and the sculk shrieker summoning it, villager breeding and gossip, spawned mob gear enchantments, the resource pack screen, a dedicated server mode, and worlds older than 1.17.
## Getting it
Builds for **Linux x86-64**, **macOS Apple Silicon** and **Windows x64** are attached to the [releases](https://github.com/ludovic111/horizon/releases). Each folder holds the game, the resource preparation tool and a `PLAY.txt`; the first start prepares the resources from your own copy of the game, as below. You can also build from source.
**Platform.** A GPU with Vulkan on Linux and Windows, or any Apple Silicon Mac. Development and the vanilla harnesses run on Linux.
**Requirements.** Python 3.10 or newer and JDK 25 (for resource preparation). To build from source: Rust 1.90 or newer, and on Linux the ALSA development headers (`libasound2-dev` on Debian and Ubuntu).
### Bring your own copy
Horizon contains no game files and never downloads them. It builds its resources from **your own copy** of Minecraft: Java Edition 26.3, verified against the checksums in `research-lock.json`:
1. **Client:** install Java Edition with the official launcher and play 26.3 once. Horizon reads `versions/26.3/`, `libraries/` and `assets/` from the launcher's game directory (`~/.minecraft` on Linux). If yours lives elsewhere, pass `--minecraft-dir` or set `HORIZON_MINECRAFT_DIR`.
2. **Server jar:** download the 26.3 server jar yourself, from [minecraft.net/download/server](https://www.minecraft.net/en-us/download/server) while 26.3 is the current release, or otherwise from the `downloads.server.url` in your launcher's `versions/26.3/26.3.json`. Pass it with `--server-jar` or set `HORIZON_SERVER_JAR`. It is only needed the first time.
### Build and run
```sh
git clone https://github.com/ludovic111/horizon.git
cd horizon
python3 tools/prepare_native_client.py --prepare --server-jar ~/Downloads/server.jar # needs JDK 25
python3 tools/fetch_sounds.py # optional: sounds from your launcher install
cargo run --release -p horizon-client
```
Everything prepared lands in the gitignored `.local/`. It is derived from the game: never commit it or share it.
## Usage
The client starts on the title screen. Command-line options (`--world`, `--seed`, `--creative`, `--render-distance`), controls, scripting through `horizon-ctl`, and packaging for another of your own Linux machines are described in [the native client guide](docs/native-client.md).
## Documentation
- [Native client](docs/native-client.md): running, options, controls, scripting and architecture.
- [Rust rewrite status](docs/rust-parity.md): completion criteria and per-area scope.
- Parity notes: [block behaviours and ticking](docs/parity/blocks.md), [section meshing](docs/parity/meshing.md).
- [Decompilation and Rust research lab](docs/research-lab.md): the local game inspection workspace and the first research crates.
- [Decompilation status](docs/decompilation-status.md).
- [Java performance packs](docs/java-packs.md): the earlier, no longer developed Java track.
## Project status
Parity is **not** complete. The table below is the project's own audit of each subsystem. Still missing: the warden's brain and the sculk shrieker summoning it, villager breeding and gossip, spawned mob gear enchantments, the resource pack screen, a dedicated server mode, and worlds older than 1.17.
### Java parity: 88%
@@ -46,14 +140,6 @@ from vanilla in places: `mob_ai` (71 of 72 scenarios; a tempted ghastling) and
| Audio | 1 | None: the sound engine, sound events, music, situational music, ambience and subtitles match vanilla |
| Block behaviours and ticking | 0.75 | Block updates, random ticks, redstone, dispensers (6,000 cases), crafters (4,000 crafts) and block entity removal (containers spill, 4,000 cases) match vanilla; 8 of 435 sculk scenarios differ (shrieker warnings and warden summoning) and the copper golem's chest sorting is not compared |
### Next steps
1. Finish the warden's brain and the sculk shrieker summoning it, and the tempted ghastling.
2. Villager breeding and gossip, and spawned mob gear enchantments (both started on their branches).
3. A dedicated server mode, and LAN hosting tested with a vanilla client.
4. Save upgrades from before 1.17, and the resource pack screen.
5. Platform-independent float math, so every harness also gives vanilla's results on macOS.
### What's new since the previous version
- **Mob AI matches vanilla**, compared tick by tick in 72 scenarios, with villagers on a port of vanilla's brain (memories, sensors, schedules and behaviours).
@@ -65,289 +151,45 @@ from vanilla in places: `mob_ai` (71 of 72 scenarios; a tempted ghastling) and
- **Worlds from 1.17 onwards** open and are upgraded as vanilla does; server.properties, eula.txt and the server user lists are read and written as vanilla does.
- **Builds for Linux, macOS (Apple Silicon) and Windows.**
### Play
### Roadmap
Builds for Linux x86_64, macOS Apple Silicon and Windows x64 are attached to the [releases](https://github.com/ludovic111/horizon/releases). Each folder contains the game, the resource preparation tool and a `PLAY.txt`. You need your own copy of Minecraft Java Edition 26.3, Python 3.12 and Java 25. The first start imports the game's files from your installation; Horizon distributes none of them. To build from source instead:
1. Finish the warden's brain and the sculk shrieker summoning it, and the tempted ghastling.
2. Villager breeding and gossip, and spawned mob gear enchantments (both started on their branches).
3. A dedicated server mode, and LAN hosting tested with a vanilla client.
4. Save upgrades from before 1.17, and the resource pack screen.
5. Platform-independent float math, so every harness also gives vanilla's results on macOS.
The rewrite is complete when it reaches one-to-one parity and packaged native builds pass the launch checks in [Rust rewrite status](docs/rust-parity.md#completion-criteria-and-playable-builds).
### After the rewrite
Once Horizon matches vanilla, the plan is to build on that exact base:
- **Performance:** optimize the client and the server as far as they can go (rendering, chunk generation and meshing, memory, multithreaded ticking) while the differential harnesses keep gameplay identical to vanilla.
- **Modding support:** a stable API for writing mods against Horizon.
- **Agent control:** an MCP server and a CLI so AI agents and scripts can play and drive the game, growing out of today's `horizon-ctl` scripting socket.
- **Built-in recording:** capture gameplay video in a keypress, without external tools.
- **Automatic version updates:** a pipeline that ports each new Minecraft release on its own: compare the new version with the pinned one, regenerate the data, rewrite the changed parts and prove them with the same differential harnesses.
## Contributing
Issues and pull requests are welcome. Before opening a pull request, run the offline checks:
```sh
python3 tools/prepare_native_client.py --prepare # needs JDK 25; extracts private vanilla resources
python3 tools/fetch_sounds.py # optional: vanilla sounds
cargo run --release -p horizon-client
```
**Platforms:** development and the vanilla harnesses run on Linux (Ubuntu 26.04, Intel i7-13700KF, NVIDIA RTX 4080, GNOME on Wayland), with a Mac mini running harnesses too. Release builds are made for Linux x86_64, macOS Apple Silicon and Windows x64. Track implementation and acceptance criteria in [Rust rewrite status](docs/rust-parity.md).
**Java performance packs (no longer developed):** the earlier track of pinned Java performance packs, distant terrain, an original frame/tick recorder and client/server starter downloads. No release downloads are published; build the packs and starters locally with `python3 tools/build_release.py` (see [Build and run](#build-and-run)). They are no longer a development target.
## Java packs: Mac starter (out of scope)
Build **horizon-mac-starter-0.21.0.zip** with `python3 tools/build_release.py` (it lands in `dist/`), extract it and open `Mac-Start.command`. It verifies and installs official universal Prism Launcher in `~/Applications` if needed, then opens the balanced pack import. Sign into Microsoft **inside Prism yourself**. This project needs no credentials.
Use native **Java 25 ARM64**, maximum heap **6144 MiB**, minimum **512 MiB** on your 16 GB M2 Pro. Prism can download Java automatically. Start at 1280×800 or 1920×1200; full Retina resolution is a larger GPU workload. [START-HERE.txt](packs/START-HERE.txt) has details. The same `.mrpack` files import into Prism on Windows and Linux.
If Prism is already installed, follow the [Mac import and first comparison guide](docs/mac-first-test.md).
Core and balanced also pass [macOS title/demo-world rendering probes](docs/client-graphics-smoke.md)
on the hosted ARM64 software renderer, including readback, saves and clean exits.
Physical M2 GPU performance and macOS 27 remain to be tested.
| Profile | Full-detail chunks | Distant LOD radius | Suggested maximum heap |
| --- | ---: | ---: | ---: |
| baseline | 12 | none | 6144 MiB |
| core-performance | 12 | none | 6144 MiB |
| m2-balanced | 12 | 128 | 6144 MiB |
| adaptive (experiment) | 12 | 128 | 6144 MiB |
| worker-pacing (experiment) | 12 | 128 | 6144 MiB |
| adaptive-pacing (experiment) | 12 | 128 | 6144 MiB |
| queue-wait (experimental) | 12 | 128 | 6144 MiB |
| adaptive-queue (experimental) | 12 | 128 | 6144 MiB |
| dispatch-retry (experimental) | 12 | 128 | 6144 MiB |
| tick-dedup (experimental) | 12 | 128 | 6144 MiB |
| culling-empty (experimental) | 12 | 128 | 6144 MiB |
| quad-reuse (experimental) | 12 | 128 | 6144 MiB |
| terrain-position (experimental) | 12 | 128 | 6144 MiB |
| culling-rays (experimental) | 12 | 128 | 6144 MiB |
| foreground-first (combined experiment) | 12 | 128 | 6144 MiB |
| foreground-vulkan (combined experiment) | 12 | 128 | 6144 MiB |
| low-memory | 8 | none | 3072 MiB |
| far-distance | 12 | 256 | 8192 MiB, with sufficient physical RAM |
| cinematic | 12 | 128 | 6144 MiB |
| vulkan | 12 | 128 | 6144 MiB |
Balanced combines [Sodium](https://modrinth.com/mod/sodium), [Lithium](https://modrinth.com/mod/lithium), [FerriteCore](https://modrinth.com/mod/ferrite-core), [ImmediatelyFast](https://modrinth.com/mod/immediatelyfast), [EntityCulling](https://modrinth.com/mod/entityculling), and [Distant Horizons](https://modrinth.com/mod/distanthorizons). Cinematic adds [Iris](https://modrinth.com/mod/iris) and [Complementary Reimagined](https://modrinth.com/shader/complementary-reimagined), initially disabled. Vulkan independently experiments with the game's own backend and fallback, without Iris.
Distant LOD is simplified terrain. Nearby blocks retain full detail. Initial generation costs CPU/disk/memory and needs warm-up. DH adjusts clouds, chunk fade and transparency to blend its renderer; assess appearance as well as speed. Shaders cost GPU time and have [Mac-specific limits](https://shaders.properties/current/reference/miscellaneous/macos/). Universal CPU/GPU support and exact vanilla equivalence remain validation goals. Simulation distance stays 12 in every profile; normal 20 TPS rules are retained.
For the first comparison at the same view distance, use `baseline` versus
`core-performance`: both select 12 full-detail chunks and no distant LOD or shaders.
The latter adds only the pinned core performance mods and leaves every original
controller disabled. Then test balanced separately for its additional distant
terrain. Matching captured settings does not prove pixel-identical rendering.
[Core comparison protocol and selected observations](docs/core-performance.md)
include three repeated matched-view software-rendered pairs with 14–21% higher
FPS in this workload; M2 performance remains unmeasured.
[Heap budget experiment](docs/heap-budget.md): three pairs with 3 GiB versus
1.5 GiB maximum heap show variable RAM savings and GC/frame-time tradeoffs;
playable defaults remain unchanged.
[Matched graphics API comparison](docs/graphics-api-comparison.md): Vulkan adds
about 1.5% average FPS but about 12% CPU in three Linux software-rendered pairs;
backend defaults remain unchanged and physical Mac performance is unmeasured.
The optional `queue-wait` pack yields during pending distant-terrain debounce retries; `adaptive-queue` combines it with the existing controllers. [Queue experiment and measurement limits](docs/debounce-queue.md).
Version 0.16 adds a separate [terrain position arithmetic experiment](docs/terrain-position.md)
for the sampled full-data lookup. It retains the pinned library’s unusual
negative-coordinate rounding and invalid-level errors. Balanced keeps it off;
whole-game and Mac performance still require measurement.
Version 0.15 adds an isolated [culling ray scratch experiment](docs/culling-rays.md)
that reuses two numeric vectors within each culling instance while retaining
upstream arithmetic and decisions. Balanced keeps it off; hardware gains remain
unmeasured.
Version 0.14 adds an isolated [empty culling whitelist experiment](docs/culling-empty.md)
that avoids allocating iterators while there are no dynamic handlers. Live
registration and nonempty callbacks retain upstream behavior. Balanced keeps it
off; whole-game gains still need hardware comparisons. DH profiles also request
a scoped [interruptible blending-read wait](docs/terrain-read-wait.md) to let
background workers leave a pending metadata read during shutdown.
Version 0.13 adds an isolated [tick membership experiment](docs/tick-membership.md)
that reuses compact storage for DH's private per-tick membership checks. The
combined foreground profiles include it too; balanced keeps it off. The applied
holder test verifies action semantics and removes repeated entry allocations;
whole-game FPS and RAM gains still need hardware measurements.
Version 0.12 captures effective distant-terrain quality, radius, worker budgets,
Iris state and field of view. Start/end snapshots flag changed visual settings;
[measurement details](docs/terrain-measurements.md) explain their limits.
Version 0.11 adds combined foreground-first OpenGL/Vulkan profiles with a 120 FPS
adaptive goal, plus explicit collector experiments and GC measurement guidance.
See [combined controls](docs/foreground-first.md), [Vulkan on your Mac](docs/vulkan.md)
and [collector comparisons](docs/collectors.md). The frame goal is not a rendering cap.
Version 0.10 adds an isolated [rejected-dispatch retry experiment](docs/dispatch-retry.md).
It bounds retry passes when a DH worker rejects queued work, preserving original
requeue handling and allowing other executors to progress. Balanced keeps it off.
Version 0.9 also makes the queue's idle wait wakeable for incoming work, preserving
its debounce rules and bounded cache-maintenance cadence. It remains part of the
optional queue profiles, with separate wake-latency measurements.
Version 0.8 fixes a fresh-instance graphics preset that could override the selected
render distance. It also records actual GC/header settings and supports an optional
[compact object headers experiment](docs/compact-headers.md) for Java 25; packs
do not enable that JVM flag automatically.
## Measure on your hardware
The optional [adaptive terrain experiment](docs/adaptive-terrain.md) throttles distant
terrain background work when frames slow down or heap pressure rises, keeping the
balanced profile's view distances and simulation settings. It remains opt-in until
real hardware demonstrates a benefit.
The additional [precise worker pacing experiment](docs/worker-pacing.md) makes short
terrain tasks respect their duty-cycle budget and avoids boxed worker timestamps.
It changes generation speed and CPU use, so it stays separate from balanced.
Press **F8** during gameplay to start a 120-second recording, or again to stop early. Rebind in Controls if needed. This also works with restricted chat accounts. Alternatively: `/horizon bench <label> 120`, `/horizon stop`, `/horizon status`.
Use separate identical world copies and the same camera route, resolution, render/simulation distance, heap, VSync and FPS limit. Warm up, then alternate at least three baseline/optimized runs. Test fresh chunk exploration separately. For everyday play cap FPS or enable VSync to reduce power usage.
The instance's `horizon-benchmarks/` folder receives JSON/CSV frame and integrated-server tick timings: average FPS, slowest-1%-average FPS, p95/p99 durations, stalls, JVM heap/GC, sampled process RSS when available, GPU/backend/driver and render settings. Frames include presentation/limiting waits and exclude menus/pauses/unfocused time. Tick `meanRate` is execution capacity, **not TPS**; observed tick counts are separate. Version 0.20 [captures sampled tick-manager state](docs/tick-state.md), including restored freeze/step/sprint/rate changes; this does not measure completed world work. Resident process memory is sampled on a shared background thread only during recordings; it includes native resident pages, while heap measures JVM objects. Neither is a complete measurement of unified GPU memory. [Memory measurement details](docs/process-memory.md).
```sh
python3 tools/compare_benchmarks.py baseline-frames.json optimized-frames.json --strict
```
Open `Compare-Benchmarks.html` from the starter ZIP or [the source file](tools/Compare-Benchmarks.html) in your browser to compare without Python. Select each JSON and optionally its matching CSV. It exports summary JSON, flags settings and duration differences, and charts frames by recorded active time or ticks by sample number. It is self-contained and makes no network requests.
Version 0.18 adds an isolated [terrain quad reuse experiment](docs/quad-reuse.md).
It reuses a temporary quad discarded by successful premerge when the existing
pool would otherwise allocate. Generated geometry and thread ownership checks
pass; allocation results are not whole-game RAM or FPS evidence. It remains off
in combined profiles.
Version 0.17 also records loaded mod versions and the Java vendor, VM and runtime
build in client and server reports. Both comparison tools flag software changes
as explicit experiment variables; older reports remain usable with an unknown
software warning. The viewer can expand the complete loaded mod list.
[Live software identity check](benchmarks/software-identity-2026-10-04/live-observations.json)
records the metadata and file-count validation; its short capture is not a
performance comparison.
The comparison flags captured setting differences, but cannot verify route, world, shader state or cache warm-up. See [validation evidence](docs/playable-validation.md). Software-renderer test FPS is not evidence of a Mac/GPU speedup.
For CPU/allocation investigation, [capture and stream a private JFR summary](docs/profiling.md).
It distinguishes directly observed allocation counters from sampled hot methods;
profiling runs remain separate from normal timing comparisons.
## Build and run
Requires Python 3.10+ and JDK 25. No Gradle, Rust or native compilation is required for playable packs.
```sh
python3 tools/build_mod.py
python3 tools/build_release.py
```
Gitignored `dist/` contains twenty packs, our original instrumentation JAR, client/server starter ZIPs and SHA256SUMS. [mods.lock.json](packs/mods.lock.json) pins mod versions, exact dependency closure, SHA-1/SHA-512 and source/license; [fabric.lock.json](packs/fabric.lock.json) pins loader/library SHA-256. Packs use the [Modrinth format](https://support.modrinth.com/en/articles/8802351-modrinth-modpack-format-mrpack). They embed only original project code; third-party mods, game and assets download from their publishers.
The server starter uses Lithium/FerriteCore and `/horizonserver bench <label> <seconds>`. [Server instructions](docs/server-quickstart.txt) cover setup and a baseline. Files are prepared before you accept Minecraft's EULA locally. A 50-active-player workload remains to be measured.
Local smoke testing uses the game's built-in limited demo; normal play uses Prism's licensed account authentication:
```sh
python3 tools/build_pack.py --profile m2-balanced --instance .local/runtime/m2-balanced
vscreen run python3 tools/runtime.py demo --instance .local/runtime/m2-balanced
```
The standalone demo launcher applies the pinned official manifest's conditional
JVM flags, including macOS `-XstartOnFirstThread` and the Windows heap-dump-path
option. Prism applies its own official manifest. Server JVM policy is separate;
this launcher correction is not a measured graphics performance improvement.
## Local game inspection
Game JARs, decompiled Java, libraries, inventories, worlds and logs live **inside this checkout** under gitignored **`.local/`**. No game code is in Git history or release downloads. Fresh clones regenerate the inspection workspace from official downloads; Microsoft credentials are not needed for this step.
```sh
git clone https://github.com/ludovic111/horizon.git
cd horizon
git config core.hooksPath .githooks
python3 tools/lab.py prepare
python3 tools/lab.py decompile
python3 tools/lab.py status
```
`research-lock.json` pins the official manifest and Vineflower. The inner server JAR is extracted and checked; client/server libraries provide decompiler context. Output: `.local/minecraft/26.3/sources/{client,server}/` and coverage/inventory reports. Current inventories cover 11,383 client classes and 7,762 server classes, producing 7,301/5,037 Java files. See [decompilation status](docs/decompilation-status.md).
Class-file SourceFile metadata covers inner classes, which often share a source file. Coverage does not prove semantic equivalence or recompilability; original bytecode remains the reference. Completed source directories are not overwritten automatically. Older obfuscated releases require a separate remapping stage.
## Original Rust research
The dependency-free `horizon-core` crate starts the Rust simulation foundation:
integer block/chunk/section positions, legacy and xoroshiro seeded random streams and positional factories,
padded palette-index storage, scheduled block/fluid tick queues, and double-precision
bounding-box and voxel-grid collision geometry. Noise samplers, octave stacks and
bulk density kernels provide the next world-generation foundation. Compiled
density samplers add gradients, shifted and blended terrain noise, distance
metrics and arithmetic evaluation.
Differential runners compare selected
operations with the checksum-pinned vanilla client and server bytecode.
[Implemented scope, validation, and remaining rewrite work](docs/rust-parity.md).
```sh
python3 tools/test_rust_parity.py --prepare
python3 tools/test_world_parity.py
python3 tools/test_tick_parity.py
python3 tools/test_geometry_parity.py
python3 tools/test_collision_parity.py
python3 tools/test_noise_parity.py
python3 tools/test_density_parity.py
```
The core corpus checks 1,634,520 output lines per reference JAR, including
signed boundaries, RNG rejection/state consumption and raw storage words.
Passing it does not establish full gameplay parity or an FPS improvement.
The separate [noise suite](docs/noise-generation.md) checks 26.3 Perlin/simplex,
derivatives, density-volume accumulation, stack composition, normal-noise
normalization and modern/legacy initialization against both reference JARs.
The [density suite](docs/density-functions.md) checks compiled scalar and bulk
evaluation, including nested samplers, their different arithmetic paths, and
selected interval operations used for graph range analysis.
`horizon-world` adds NBT, four region compression codecs, `.mca`/`.mcc`
reading and export, saved palettes, a version-checked block-state registry,
and packed resident block sections. The world-data suite checks Rust output
with the actual vanilla NBT, region and block-state decoders on both JARs.
It covers all 35,723 exported state IDs and a 100,000-edit section trace.
[World-data commands and validation limits](docs/world-data.md).
Scheduled ticks now support vanilla ordering, duplicate suppression, save/reload,
chunk eligibility and callback mutations. The tick suite compares 97,776 output
lines per reference JAR and checks saved block/fluid lists through vanilla codecs
and region files. [Scheduler behavior and remaining integration](docs/scheduled-ticks.md).
Voxel shapes preserve vanilla collision tolerances, greedy box ordering, ray faces,
inside hits, and cube-versus-array cell lookup. A cached collision registry connects
imported shapes to resident block sections while checking exact state identities.
Movement helpers resolve supplied colliders and step-up candidates, including
landing adjustment and the second collider query. Movement-path block visits
preserve vanilla ordering, step indices and packed-position deduplication.
Uncached states require block behavior; the entity-context overload also needs
separate implementation. [Geometry and collision scope](docs/collision-geometry.md).
```sh
cargo test --workspace
cargo run --release --bin voxel-bench -- 100 > .local/voxel-benchmark.csv
```
The dependency-free occupancy experiment compares scalar and bitset exposed-face counting for synthetic 16³ sections. It has no real mesh, material/AO/light work, neighboring-section context, JNI bridge or game integration. Speedups are kernel-only, not Minecraft FPS. [Research plan](docs/optimization-plan.md) describes profiling, improved Java baselines, native integration and behavior checks before expanding scope.
Public branding and new mod downloads use **Horizon**. The existing Fabric mod
ID and `dev.horizonlab` namespace remain stable for installed instances and
measurement compatibility. The installer backs up both old `horizon-lab-*.jar`
and new `horizon-*.jar` versions before installing an update.
## Validation and ownership
```sh
python3 -m unittest discover -s tests -v
python3 tools/build_mod.py --test-only
cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
python3 tools/check_public_tree.py
python3 tools/check_public_tree.py --history
```
CI checks offline tools/Rust and compiles the original mod/builds packs on Linux and Apple Silicon macOS. Game dependencies download to ephemeral `.local/`; CI uploads only our original JAR and packs. Compilation is not Mac GPU gameplay testing. Publication checks allow Java only under our original `dev/horizonlab` namespace; review diffs as well.
CI runs these checks on GitHub's Linux runners. The vanilla comparisons need the game, which Horizon never downloads, so they run only when started by hand on a self-hosted runner holding the maintainer's own copy. Never commit game files, decompiled source or prepared resources: `tools/check_public_tree.py` rejects them, and tracked Java is allowed only under the project's own `dev/horizonlab` namespace.
[MIT](LICENSE) covers only our original tracked work. Dependencies retain their licenses. Mojang [removed obfuscation](https://www.minecraft.net/en-us/article/removing-obfuscation-in-java-edition) without changing [Minecraft's EULA](https://www.minecraft.net/en-us/eula). Decompiled game source remains local; published code implements independent tooling and instrumentation.
## Licence
Integrated-server reports record the shared graphics backend at recording start; see [the context and comparison limits](docs/server-graphics-context.md).
[MIT](LICENSE), for the project's original work only. Dependencies keep their own licences. Minecraft is a trademark of Mojang Synergies AB; Minecraft code and assets belong to Mojang and Microsoft and are covered by the [Minecraft EULA](https://www.minecraft.net/en-us/eula). Decompiled game source and prepared resources stay on your machine and are never published.
## Author
Made by [Ludovic Marie](https://lu4ovic.com) ([@ludovic111](https://github.com/ludovic111)).
+113 -103
View File
@@ -2964,121 +2964,128 @@ impl Game<'_> {
batch.text(atlas, text, (w - tw) / 2.0, h / 2.0 - 4.0, u32::MAX, true);
return batch;
}
self.draw_spyglass(&mut batch);
// Hud.extractCrosshair / extractItemHotbar / extractPlayerHealth /
// extractVehicleHealth and the experience bar, laid out by hud_layout.
// Horizon has no attack cooldown yet: the strength is always full.
// Hud.extractRenderState: F1 (keyToggleGui) hides camera overlays, the
// crosshair, hotbar, effects, bars, sidebar, action bar, titles and chat;
// the sleep overlay, debug screen and open screens still draw.
let spectator = self.spectator();
let (wi, hi) = (w as i32, h as i32);
let indicator = self.settings.attack_indicator;
if self.camera_type.first_person() && !spectator {
let attack = (indicator == 1).then_some(1.0);
let draws = hud_layout::crosshair(wi, hi, attack, false);
hud_layout::paint(&mut batch, &self.res.atlas, &draws);
}
if !spectator {
let inputs = hud_layout::HotbarInputs {
selected: self.selected as i32,
right_handed: !self.settings.main_hand_left,
offhand: self.offhand.is_some(),
slots: std::array::from_fn(|i| self.inventory[i].as_ref().map(|_| 0.0)),
offhand_pop: 0.0,
attack: (indicator == 2).then_some(1.0),
};
let draws = hud_layout::hotbar(wi, hi, &inputs);
hud_layout::paint(&mut batch, &self.res.atlas, &draws);
for d in &draws {
if let hud_layout::GuiDraw::Item { slot, x, y, .. } = *d {
let stack = if slot == 40 {
self.offhand.clone()
} else {
self.inventory[slot as usize].clone()
};
if let Some(stack) = stack {
self.draw_item(&mut batch, &stack, x as f32, y as f32);
if !self.ui.hide_gui {
self.draw_spyglass(&mut batch);
// Hud.extractCrosshair / extractItemHotbar / extractPlayerHealth /
// extractVehicleHealth and the experience bar, laid out by hud_layout.
// Horizon has no attack cooldown yet: the strength is always full.
let indicator = self.settings.attack_indicator;
if self.camera_type.first_person() && !spectator {
let attack = (indicator == 1).then_some(1.0);
let draws = hud_layout::crosshair(wi, hi, attack, false);
hud_layout::paint(&mut batch, &self.res.atlas, &draws);
}
if !spectator {
let inputs = hud_layout::HotbarInputs {
selected: self.selected as i32,
right_handed: !self.settings.main_hand_left,
offhand: self.offhand.is_some(),
slots: std::array::from_fn(|i| self.inventory[i].as_ref().map(|_| 0.0)),
offhand_pop: 0.0,
attack: (indicator == 2).then_some(1.0),
};
let draws = hud_layout::hotbar(wi, hi, &inputs);
hud_layout::paint(&mut batch, &self.res.atlas, &draws);
for d in &draws {
if let hud_layout::GuiDraw::Item { slot, x, y, .. } = *d {
let stack = if slot == 40 {
self.offhand.clone()
} else {
self.inventory[slot as usize].clone()
};
if let Some(stack) = stack {
self.draw_item(&mut batch, &stack, x as f32, y as f32);
}
}
}
}
self.draw_effect_icons(&mut batch);
// Hud: the action bar and titles draw over the hotbar (nextStratum).
self.draw_boss_bars(&mut batch);
}
self.draw_effect_icons(&mut batch);
// Hud: the action bar and titles draw over the hotbar (nextStratum).
self.draw_boss_bars(&mut batch);
// Hud.extractSleepOverlay, under the sidebar, titles and chat.
if let Some((_, ticks)) = self.sleeping {
let draws = hud_overlays::sleep_overlay(wi, hi, ticks as i32);
hud_layout::paint(&mut batch, &self.res.atlas, &draws);
}
self.draw_titles(&mut batch);
self.draw_scoreboard(&mut batch);
self.draw_subtitles(&mut batch);
// The mount's hearts (and the jump bar that replaces the experience bar).
let (vehicle_hearts, jump_bar) = if spectator {
(0, false)
} else {
self.draw_mount_hud(&mut batch, wi, hi)
};
if !self.creative
&& !spectator
&& let Some(p) = &mut self.player
{
let atlas = &self.res.atlas;
let width = |s: &str| HudBatch::text_width(atlas, s) as i32;
let draws = hud_layout::experience(
wi,
hi,
self.experience.progress,
self.experience.level,
!jump_bar,
&width,
);
hud_layout::paint(&mut batch, atlas, &draws);
let effects = &self.potions.effects;
let kind = if effects.get("poison").is_some() {
hud_layout::HeartKind::Poisoned
} else if effects.get("wither").is_some() {
hud_layout::HeartKind::Withered
if !self.ui.hide_gui {
self.draw_titles(&mut batch);
self.draw_scoreboard(&mut batch);
self.draw_subtitles(&mut batch);
// The mount's hearts (and the jump bar that replaces the experience bar).
let (vehicle_hearts, jump_bar) = if spectator {
(0, false)
} else {
hud_layout::HeartKind::Normal
self.draw_mount_hud(&mut batch, wi, hi)
};
let eye = p.position.y + f64::from(p.dimensions.eye_height);
let under_water = self
.res
.facts
.get(self.world.block(
p.position.x.floor() as i32,
eye.floor() as i32,
p.position.z.floor() as i32,
))
.fluid
== horizon_client::blocks::Fluid::Water;
let inputs = hud_layout::HealthInputs {
tick: self.ticks as i32,
millis: self.started.elapsed().as_millis() as i64,
health: p.health.health(),
max_health: p.attribute("minecraft:max_health").unwrap_or(20.0) as f32,
absorption: p.health.absorption(),
armor: p
.attribute("minecraft:armor")
.or_else(|_| p.attribute("armor"))
.unwrap_or(0.0) as i32,
food: p.health.food.food,
saturation: p.health.food.saturation,
kind,
regeneration: effects.get("regeneration").is_some(),
hunger: effects.get("hunger").is_some(),
hardcore: self.level.hardcore,
damage_cooldown: p.health.hurt.cooldown > 0,
// Horizon does not track the player's air supply yet.
air: 300,
max_air: 300,
under_water,
vehicle_hearts,
};
let draws = self.health_hud.layout(&inputs, wi, hi);
hud_layout::paint(&mut batch, atlas, &draws);
}
if !spectator {
self.draw_selected_name(&mut batch, !self.creative);
if !self.creative
&& !spectator
&& let Some(p) = &mut self.player
{
let atlas = &self.res.atlas;
let width = |s: &str| HudBatch::text_width(atlas, s) as i32;
let draws = hud_layout::experience(
wi,
hi,
self.experience.progress,
self.experience.level,
!jump_bar,
&width,
);
hud_layout::paint(&mut batch, atlas, &draws);
let effects = &self.potions.effects;
let kind = if effects.get("poison").is_some() {
hud_layout::HeartKind::Poisoned
} else if effects.get("wither").is_some() {
hud_layout::HeartKind::Withered
} else {
hud_layout::HeartKind::Normal
};
let eye = p.position.y + f64::from(p.dimensions.eye_height);
let under_water = self
.res
.facts
.get(self.world.block(
p.position.x.floor() as i32,
eye.floor() as i32,
p.position.z.floor() as i32,
))
.fluid
== horizon_client::blocks::Fluid::Water;
let inputs = hud_layout::HealthInputs {
tick: self.ticks as i32,
millis: self.started.elapsed().as_millis() as i64,
health: p.health.health(),
max_health: p.attribute("minecraft:max_health").unwrap_or(20.0) as f32,
absorption: p.health.absorption(),
armor: p
.attribute("minecraft:armor")
.or_else(|_| p.attribute("armor"))
.unwrap_or(0.0) as i32,
food: p.health.food.food,
saturation: p.health.food.saturation,
kind,
regeneration: effects.get("regeneration").is_some(),
hunger: effects.get("hunger").is_some(),
hardcore: self.level.hardcore,
damage_cooldown: p.health.hurt.cooldown > 0,
// Horizon does not track the player's air supply yet.
air: 300,
max_air: 300,
under_water,
vehicle_hearts,
};
let draws = self.health_hud.layout(&inputs, wi, hi);
hud_layout::paint(&mut batch, atlas, &draws);
}
if !spectator {
self.draw_selected_name(&mut batch, !self.creative);
}
}
let atlas = &self.res.atlas;
if self.debug {
@@ -3174,7 +3181,8 @@ impl Game<'_> {
);
}
}
if let Some((text, at)) = &self.message
if !self.ui.hide_gui
&& let Some((text, at)) = &self.message
&& at.elapsed() < Duration::from_secs(3)
{
let tw = HudBatch::text_width(atlas, text);
@@ -6356,7 +6364,9 @@ impl Game<'_> {
/// space, converted to camera-relative world space.
fn hand_geometry(&mut self, alpha: f64) -> Vec<Vertex> {
let mut out = Vec::new();
// GameRenderer.renderItemInHand: F1 hides the hand with the HUD.
if self.spectator()
|| self.ui.hide_gui
|| !self.camera_type.first_person()
|| self
.player
+1 -1
View File
@@ -689,7 +689,7 @@ impl Game<'_> {
self.system_message(message);
}
}
/// F1 hides the HUD (and hand); the screenshot key still works.
/// F1 hides the HUD (see `hud`); the screenshot key still works.
pub(super) fn toggle_hide_gui(&mut self) {
self.ui.hide_gui = !self.ui.hide_gui;
}
+176
View File
@@ -0,0 +1,176 @@
# Java performance packs (no longer developed)
Before the Rust rewrite, Horizon was a lab for Minecraft Java client performance: pinned Fabric performance packs, distant terrain, an original frame and tick recorder, and client and server starter downloads. This track is **no longer developed**. No release downloads are published; build the packs and starters locally with `python3 tools/build_release.py` (see [Build and run](#build-and-run)). This page keeps its documentation.
## Java packs: Mac starter (out of scope)
Build **horizon-mac-starter-0.21.0.zip** with `python3 tools/build_release.py` (it lands in `dist/`), extract it and open `Mac-Start.command`. It verifies and installs official universal Prism Launcher in `~/Applications` if needed, then opens the balanced pack import. Sign into Microsoft **inside Prism yourself**. This project needs no credentials.
Use native **Java 25 ARM64**, maximum heap **6144 MiB**, minimum **512 MiB** on a 16 GB M2 Pro Mac. Prism can download Java automatically. Start at 1280×800 or 1920×1200; full Retina resolution is a larger GPU workload. [START-HERE.txt](../packs/START-HERE.txt) has details. The same `.mrpack` files import into Prism on Windows and Linux.
If Prism is already installed, follow the [Mac import and first comparison guide](mac-first-test.md).
Core and balanced also pass [macOS title/demo-world rendering probes](client-graphics-smoke.md)
on the hosted ARM64 software renderer, including readback, saves and clean exits.
Physical M2 GPU performance and macOS 27 remain to be tested.
| Profile | Full-detail chunks | Distant LOD radius | Suggested maximum heap |
| --- | ---: | ---: | ---: |
| baseline | 12 | none | 6144 MiB |
| core-performance | 12 | none | 6144 MiB |
| m2-balanced | 12 | 128 | 6144 MiB |
| adaptive (experiment) | 12 | 128 | 6144 MiB |
| worker-pacing (experiment) | 12 | 128 | 6144 MiB |
| adaptive-pacing (experiment) | 12 | 128 | 6144 MiB |
| queue-wait (experimental) | 12 | 128 | 6144 MiB |
| adaptive-queue (experimental) | 12 | 128 | 6144 MiB |
| dispatch-retry (experimental) | 12 | 128 | 6144 MiB |
| tick-dedup (experimental) | 12 | 128 | 6144 MiB |
| culling-empty (experimental) | 12 | 128 | 6144 MiB |
| quad-reuse (experimental) | 12 | 128 | 6144 MiB |
| terrain-position (experimental) | 12 | 128 | 6144 MiB |
| culling-rays (experimental) | 12 | 128 | 6144 MiB |
| foreground-first (combined experiment) | 12 | 128 | 6144 MiB |
| foreground-vulkan (combined experiment) | 12 | 128 | 6144 MiB |
| low-memory | 8 | none | 3072 MiB |
| far-distance | 12 | 256 | 8192 MiB, with sufficient physical RAM |
| cinematic | 12 | 128 | 6144 MiB |
| vulkan | 12 | 128 | 6144 MiB |
Balanced combines [Sodium](https://modrinth.com/mod/sodium), [Lithium](https://modrinth.com/mod/lithium), [FerriteCore](https://modrinth.com/mod/ferrite-core), [ImmediatelyFast](https://modrinth.com/mod/immediatelyfast), [EntityCulling](https://modrinth.com/mod/entityculling), and [Distant Horizons](https://modrinth.com/mod/distanthorizons). Cinematic adds [Iris](https://modrinth.com/mod/iris) and [Complementary Reimagined](https://modrinth.com/shader/complementary-reimagined), initially disabled. Vulkan independently experiments with the game's own backend and fallback, without Iris.
Distant LOD is simplified terrain. Nearby blocks retain full detail. Initial generation costs CPU/disk/memory and needs warm-up. DH adjusts clouds, chunk fade and transparency to blend its renderer; assess appearance as well as speed. Shaders cost GPU time and have [Mac-specific limits](https://shaders.properties/current/reference/miscellaneous/macos/). Universal CPU/GPU support and exact vanilla equivalence remain validation goals. Simulation distance stays 12 in every profile; normal 20 TPS rules are retained.
For the first comparison at the same view distance, use `baseline` versus
`core-performance`: both select 12 full-detail chunks and no distant LOD or shaders.
The latter adds only the pinned core performance mods and leaves every original
controller disabled. Then test balanced separately for its additional distant
terrain. Matching captured settings does not prove pixel-identical rendering.
[Core comparison protocol and selected observations](core-performance.md)
include three repeated matched-view software-rendered pairs with 14–21% higher
FPS in this workload; M2 performance remains unmeasured.
[Heap budget experiment](heap-budget.md): three pairs with 3 GiB versus
1.5 GiB maximum heap show variable RAM savings and GC/frame-time tradeoffs;
playable defaults remain unchanged.
[Matched graphics API comparison](graphics-api-comparison.md): Vulkan adds
about 1.5% average FPS but about 12% CPU in three Linux software-rendered pairs;
backend defaults remain unchanged and physical Mac performance is unmeasured.
The optional `queue-wait` pack yields during pending distant-terrain debounce retries; `adaptive-queue` combines it with the existing controllers. [Queue experiment and measurement limits](debounce-queue.md).
Version 0.16 adds a separate [terrain position arithmetic experiment](terrain-position.md)
for the sampled full-data lookup. It retains the pinned library’s unusual
negative-coordinate rounding and invalid-level errors. Balanced keeps it off;
whole-game and Mac performance still require measurement.
Version 0.15 adds an isolated [culling ray scratch experiment](culling-rays.md)
that reuses two numeric vectors within each culling instance while retaining
upstream arithmetic and decisions. Balanced keeps it off; hardware gains remain
unmeasured.
Version 0.14 adds an isolated [empty culling whitelist experiment](culling-empty.md)
that avoids allocating iterators while there are no dynamic handlers. Live
registration and nonempty callbacks retain upstream behavior. Balanced keeps it
off; whole-game gains still need hardware comparisons. DH profiles also request
a scoped [interruptible blending-read wait](terrain-read-wait.md) to let
background workers leave a pending metadata read during shutdown.
Version 0.13 adds an isolated [tick membership experiment](tick-membership.md)
that reuses compact storage for DH's private per-tick membership checks. The
combined foreground profiles include it too; balanced keeps it off. The applied
holder test verifies action semantics and removes repeated entry allocations;
whole-game FPS and RAM gains still need hardware measurements.
Version 0.12 captures effective distant-terrain quality, radius, worker budgets,
Iris state and field of view. Start/end snapshots flag changed visual settings;
[measurement details](terrain-measurements.md) explain their limits.
Version 0.11 adds combined foreground-first OpenGL/Vulkan profiles with a 120 FPS
adaptive goal, plus explicit collector experiments and GC measurement guidance.
See [combined controls](foreground-first.md), [Vulkan on your Mac](vulkan.md)
and [collector comparisons](collectors.md). The frame goal is not a rendering cap.
Version 0.10 adds an isolated [rejected-dispatch retry experiment](dispatch-retry.md).
It bounds retry passes when a DH worker rejects queued work, preserving original
requeue handling and allowing other executors to progress. Balanced keeps it off.
Version 0.9 also makes the queue's idle wait wakeable for incoming work, preserving
its debounce rules and bounded cache-maintenance cadence. It remains part of the
optional queue profiles, with separate wake-latency measurements.
Version 0.8 fixes a fresh-instance graphics preset that could override the selected
render distance. It also records actual GC/header settings and supports an optional
[compact object headers experiment](compact-headers.md) for Java 25; packs
do not enable that JVM flag automatically.
## Measure on your hardware
The optional [adaptive terrain experiment](adaptive-terrain.md) throttles distant
terrain background work when frames slow down or heap pressure rises, keeping the
balanced profile's view distances and simulation settings. It remains opt-in until
real hardware demonstrates a benefit.
The additional [precise worker pacing experiment](worker-pacing.md) makes short
terrain tasks respect their duty-cycle budget and avoids boxed worker timestamps.
It changes generation speed and CPU use, so it stays separate from balanced.
Press **F8** during gameplay to start a 120-second recording, or again to stop early. Rebind in Controls if needed. This also works with restricted chat accounts. Alternatively: `/horizon bench <label> 120`, `/horizon stop`, `/horizon status`.
Use separate identical world copies and the same camera route, resolution, render/simulation distance, heap, VSync and FPS limit. Warm up, then alternate at least three baseline/optimized runs. Test fresh chunk exploration separately. For everyday play cap FPS or enable VSync to reduce power usage.
The instance's `horizon-benchmarks/` folder receives JSON/CSV frame and integrated-server tick timings: average FPS, slowest-1%-average FPS, p95/p99 durations, stalls, JVM heap/GC, sampled process RSS when available, GPU/backend/driver and render settings. Frames include presentation/limiting waits and exclude menus/pauses/unfocused time. Tick `meanRate` is execution capacity, **not TPS**; observed tick counts are separate. Version 0.20 [captures sampled tick-manager state](tick-state.md), including restored freeze/step/sprint/rate changes; this does not measure completed world work. Resident process memory is sampled on a shared background thread only during recordings; it includes native resident pages, while heap measures JVM objects. Neither is a complete measurement of unified GPU memory. [Memory measurement details](process-memory.md).
```sh
python3 tools/compare_benchmarks.py baseline-frames.json optimized-frames.json --strict
```
Open `Compare-Benchmarks.html` from the starter ZIP or [the source file](../tools/Compare-Benchmarks.html) in your browser to compare without Python. Select each JSON and optionally its matching CSV. It exports summary JSON, flags settings and duration differences, and charts frames by recorded active time or ticks by sample number. It is self-contained and makes no network requests.
Version 0.18 adds an isolated [terrain quad reuse experiment](quad-reuse.md).
It reuses a temporary quad discarded by successful premerge when the existing
pool would otherwise allocate. Generated geometry and thread ownership checks
pass; allocation results are not whole-game RAM or FPS evidence. It remains off
in combined profiles.
Version 0.17 also records loaded mod versions and the Java vendor, VM and runtime
build in client and server reports. Both comparison tools flag software changes
as explicit experiment variables; older reports remain usable with an unknown
software warning. The viewer can expand the complete loaded mod list.
[Live software identity check](../benchmarks/software-identity-2026-10-04/live-observations.json)
records the metadata and file-count validation; its short capture is not a
performance comparison.
The comparison flags captured setting differences, but cannot verify route, world, shader state or cache warm-up. See [validation evidence](playable-validation.md). Software-renderer test FPS is not evidence of a Mac/GPU speedup.
For CPU/allocation investigation, [capture and stream a private JFR summary](profiling.md).
It distinguishes directly observed allocation counters from sampled hot methods;
profiling runs remain separate from normal timing comparisons.
## Build and run
Requires Python 3.10+ and JDK 25. No Gradle, Rust or native compilation is required for playable packs.
```sh
python3 tools/build_mod.py
python3 tools/build_release.py
```
Gitignored `dist/` contains twenty packs, our original instrumentation JAR, client/server starter ZIPs and SHA256SUMS. [mods.lock.json](../packs/mods.lock.json) pins mod versions, exact dependency closure, SHA-1/SHA-512 and source/license; [fabric.lock.json](../packs/fabric.lock.json) pins loader/library SHA-256. Packs use the [Modrinth format](https://support.modrinth.com/en/articles/8802351-modrinth-modpack-format-mrpack). They embed only original project code; third-party mods, game and assets download from their publishers.
The server starter uses Lithium/FerriteCore and `/horizonserver bench <label> <seconds>`. [Server instructions](server-quickstart.txt) cover setup and a baseline. Files are prepared before you accept Minecraft's EULA locally. A 50-active-player workload remains to be measured.
Local smoke testing uses the game's built-in limited demo; normal play uses Prism's licensed account authentication:
```sh
python3 tools/build_pack.py --profile m2-balanced --instance .local/runtime/m2-balanced
vscreen run python3 tools/runtime.py demo --instance .local/runtime/m2-balanced
```
The standalone demo launcher applies the pinned official manifest's conditional
JVM flags, including macOS `-XstartOnFirstThread` and the Windows heap-dump-path
option. Prism applies its own official manifest. Server JVM policy is separate;
this launcher correction is not a measured graphics performance improvement.
Binary file not shown.

After

Width:  |  Height:  |  Size: 320 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

+62
View File
@@ -0,0 +1,62 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="512" height="512">
<title>Horizon</title>
<defs>
<linearGradient id="sky" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#0A0F2C"/>
<stop offset="0.38" stop-color="#26206A"/>
<stop offset="0.62" stop-color="#7C3A88"/>
<stop offset="0.78" stop-color="#EE6E5A"/>
<stop offset="0.9" stop-color="#FFB25E"/>
</linearGradient>
<linearGradient id="sun" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#FFF6CF"/>
<stop offset="0.5" stop-color="#FFD272"/>
<stop offset="1" stop-color="#FF9A44"/>
</linearGradient>
<radialGradient id="glow" cx="0.5" cy="0.6" r="0.55">
<stop offset="0" stop-color="#FFC874" stop-opacity="0.6"/>
<stop offset="0.6" stop-color="#FF8A5C" stop-opacity="0.12"/>
<stop offset="1" stop-color="#FF8A5C" stop-opacity="0"/>
</radialGradient>
<linearGradient id="far" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#4A2F7E"/>
<stop offset="1" stop-color="#2B1F5E"/>
</linearGradient>
<linearGradient id="near" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#151A45"/>
<stop offset="1" stop-color="#080B22"/>
</linearGradient>
<clipPath id="tile"><rect width="512" height="512" rx="112"/></clipPath>
<clipPath id="sunCut"><rect x="0" y="0" width="512" height="352"/></clipPath>
<clipPath id="sunDisc"><circle cx="256" cy="300" r="136"/></clipPath>
</defs>
<g clip-path="url(#tile)">
<rect width="512" height="512" fill="url(#sky)"/>
<ellipse cx="256" cy="320" rx="300" ry="230" fill="url(#glow)"/>
<g clip-path="url(#sunCut)">
<circle cx="256" cy="300" r="136" fill="url(#sun)"/>
<g clip-path="url(#sunDisc)">
<rect x="100" y="262" width="312" height="8" fill="#EE6E5A" opacity="0.5"/>
<rect x="100" y="284" width="312" height="11" fill="#EE6E5A" opacity="0.62"/>
<rect x="100" y="310" width="312" height="14" fill="#EE6E5A" opacity="0.74"/>
</g>
</g>
<path fill="url(#far)" d="M0 320H64V288H128V320H352V288H416V256H512V512H0Z"/>
<path fill="url(#near)" d="M0 384H64V352H192V384H320V352H384V320H448V352H512V512H0Z"/>
<g fill="#FFFFFF" opacity="0.07">
<rect x="64" y="352" width="4" height="160"/>
<rect x="192" y="352" width="4" height="160"/>
<rect x="320" y="352" width="4" height="160"/>
<rect x="384" y="320" width="4" height="192"/>
<rect x="448" y="320" width="4" height="192"/>
<rect x="0" y="448" width="512" height="4"/>
</g>
<rect x="0" y="384" width="64" height="4" fill="#FFB25E" opacity="0.25"/>
<rect x="64" y="352" width="128" height="4" fill="#FFB25E" opacity="0.35"/>
<rect x="192" y="384" width="128" height="4" fill="#FFB25E" opacity="0.25"/>
<rect x="320" y="352" width="64" height="4" fill="#FFB25E" opacity="0.35"/>
<rect x="384" y="320" width="64" height="4" fill="#FFB25E" opacity="0.45"/>
<rect x="448" y="352" width="64" height="4" fill="#FFB25E" opacity="0.35"/>
</g>
<rect x="2" y="2" width="508" height="508" rx="110" fill="none" stroke="#FFFFFF" stroke-opacity="0.1" stroke-width="4"/>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 KiB

+18 -17
View File
@@ -8,22 +8,23 @@ hardness/tool rules, collect drops from the block loot tables, place blocks,
craft in the 2x2 inventory grid or on a crafting table, and save and reload worlds
in vanilla's Anvil format.
**Status:** playable, about 55% Java parity (see the README table). Worlds use the
Rust port of the vanilla overworld and Nether generators. Chests, furnaces, nine
mob types, fluids, redstone and crop growth run in the client. Multiplayer, the End,
most structures and mobs, and several containers are still missing. See
[Rust rewrite status](rust-parity.md).
**Status:** playable, in development. The [Java parity table](../README.md#project-status)
in the README scores each subsystem against vanilla and lists what is still
missing; [Rust rewrite status](rust-parity.md) has the details.
## Run from a checkout
Use current stable Rust (1.90+), Python 3.10+ and JDK 25. Resource preparation
verifies the pinned game artifacts, runs vanilla's data generator and small
exporters against the reference jars, and extracts the jar's assets and data
into ignored `.local/horizon-client/26.3/`. Sounds come from Mojang's asset
index (about 380 MB). Prepared resources are private; never commit them.
Use current stable Rust (1.90+), Python 3.10+ and JDK 25. Horizon never
downloads the game: resource preparation imports **your own copy** (the 26.3
client from your official launcher install, and the 26.3 server jar you
downloaded yourself; see [Bring your own copy](../README.md#bring-your-own-copy)),
verifies it against the pinned checksums, runs vanilla's data generator and small
exporters against those jars, and extracts the jar's assets and data into ignored
`.local/horizon-client/26.3/`. Sounds (about 380 MB) are copied from your
launcher's asset store. Prepared resources are private; never commit them.
```sh
python3 tools/prepare_native_client.py --prepare
python3 tools/prepare_native_client.py --prepare --server-jar ~/Downloads/server.jar
python3 tools/fetch_sounds.py
cargo run --release -p horizon-client -- --render-distance 12
```
@@ -82,7 +83,7 @@ Frame times include waits for presentation, so `bench` reports what is on screen
### Play on another of your machines
Horizon targets Linux on ludodesktop (Ubuntu 26.04, RTX 4080); macOS and Windows
Horizon targets Linux on x86-64 with an NVIDIA GPU (Vulkan); macOS and Windows
are out of scope. To play on another Linux machine
without Rust, JDK or prepared resources, package a release build where they exist:
@@ -404,8 +405,8 @@ Initial local validation uses Linux x86_64, a headless Wayland compositor and
Vulkan llvmpipe software rendering. Textured geometry and resizing were visually
inspected; movement, arrow rotation and Ctrl+Q were exercised using virtual
physical key codes. Captured relative mouse movement and Escape release were
exercised through a virtual pointer. Physical-GPU runtime tests on ludodesktop
(RTX 4080) remain pending. Software-renderer frame rates
exercised through a virtual pointer. Physical-GPU runtime tests on the target
machine remain pending. Software-renderer frame rates
are not evidence of a hardware speedup.
The model gallery was also inspected at close range on Linux/Vulkan llvmpipe.
@@ -579,7 +580,7 @@ The Ctrl run recorded 71 sprint ticks and 1,948 sprint centimeters. The double-t
run visibly showed `Sprint true` during the second press and `Sprint false`
after releasing W. Both runs ended grounded and alive without an error, and
their views were visually inspected. These are development client checks;
ludodesktop release acceptance and complete gameplay remain pending.
release acceptance on the target machine and complete gameplay remain pending.
## Crouching and dry pose transitions
@@ -618,7 +619,7 @@ visibly switched from crouching to standing after releasing Shift. It recorded
without an error. Both views were inspected. The
[renderer startup check](../benchmarks/rust-native-crouch-2026-10-07/startup-smoke.json),
seven client tests and all-target client Clippy also passed. These checks do not
establish full vanilla gameplay or final Linux release acceptance on ludodesktop.
establish full vanilla gameplay or final Linux release acceptance on the target machine.
## Pending attribute updates
@@ -657,4 +658,4 @@ recorded 36 sprinting ticks and 36 crouching ticks, ending grounded and alive
without an error. Its view was inspected. The
[startup check](../benchmarks/rust-native-attribute-updates-2026-10-07/startup-smoke.json),
seven client tests and all-target client Clippy passed. Full gameplay parity and
playable Linux release acceptance on ludodesktop remain pending.
playable Linux release acceptance on the target machine remain pending.
+1 -1
View File
@@ -2,7 +2,7 @@
## Starting point
The first playable Java foundation is in the root README. Client optimization has priority. Vanilla gameplay, world formats and multiplayer behavior must be preserved; existing modpack compatibility is not required. Any language, renderer or architecture is in scope when measured gains justify it. Windows/Linux and Apple Silicon/Intel macOS are targets, with the M2 Pro/16 GB Mac prioritized.
The first playable Java foundation is described in [Java performance packs](java-packs.md). Client optimization has priority. Vanilla gameplay, world formats and multiplayer behavior must be preserved; existing modpack compatibility is not required. Any language, renderer or architecture is in scope when measured gains justify it. Windows/Linux and Apple Silicon/Intel macOS are targets, with the M2 Pro/16 GB Mac prioritized.
Inspect both pinned game JARs locally, retain bytecode as the reference, and measure actual Minecraft workloads before selecting a subsystem to replace. The Rust face-count experiment establishes a small correctness/benchmark workflow; it does not identify a Minecraft bottleneck.
+87
View File
@@ -0,0 +1,87 @@
# Decompilation and Rust research lab
Horizon started as a decompilation and optimization lab. This page describes the local game inspection workspace and the first Rust research crates. For the playable client, see [the native client](native-client.md); for the rewrite as a whole, see [Rust rewrite status](rust-parity.md).
## Local game inspection
Game JARs, decompiled Java, libraries, inventories, worlds and logs live **inside this checkout** under gitignored **`.local/`**. No game code is in Git history or release downloads. Fresh clones rebuild the inspection workspace from your own copy of the game (see [Bring your own copy](../README.md#bring-your-own-copy)); nothing of the game is downloaded.
```sh
git clone https://github.com/ludovic111/horizon.git
cd horizon
git config core.hooksPath .githooks
python3 tools/lab.py prepare --server-jar ~/Downloads/server.jar
python3 tools/lab.py decompile
python3 tools/lab.py status
```
`research-lock.json` pins the official manifest, the client and server jar checksums, and Vineflower. The inner server JAR is extracted and checked; client/server libraries provide decompiler context. Output: `.local/minecraft/26.3/sources/{client,server}/` and coverage/inventory reports. Current inventories cover 11,383 client classes and 7,762 server classes, producing 7,301/5,037 Java files. See [decompilation status](decompilation-status.md).
Class-file SourceFile metadata covers inner classes, which often share a source file. Coverage does not prove semantic equivalence or recompilability; original bytecode remains the reference. Completed source directories are not overwritten automatically. Older obfuscated releases require a separate remapping stage.
## Original Rust research
The dependency-free `horizon-core` crate starts the Rust simulation foundation:
integer block/chunk/section positions, legacy and xoroshiro seeded random streams and positional factories,
padded palette-index storage, scheduled block/fluid tick queues, and double-precision
bounding-box and voxel-grid collision geometry. Noise samplers, octave stacks and
bulk density kernels provide the next world-generation foundation. Compiled
density samplers add gradients, shifted and blended terrain noise, distance
metrics and arithmetic evaluation.
Differential runners compare selected
operations with the checksum-pinned vanilla client and server bytecode.
[Implemented scope, validation, and remaining rewrite work](rust-parity.md).
```sh
python3 tools/test_rust_parity.py --prepare
python3 tools/test_world_parity.py
python3 tools/test_tick_parity.py
python3 tools/test_geometry_parity.py
python3 tools/test_collision_parity.py
python3 tools/test_noise_parity.py
python3 tools/test_density_parity.py
```
The core corpus checks 1,634,520 output lines per reference JAR, including
signed boundaries, RNG rejection/state consumption and raw storage words.
Passing it does not establish full gameplay parity or an FPS improvement.
The separate [noise suite](noise-generation.md) checks 26.3 Perlin/simplex,
derivatives, density-volume accumulation, stack composition, normal-noise
normalization and modern/legacy initialization against both reference JARs.
The [density suite](density-functions.md) checks compiled scalar and bulk
evaluation, including nested samplers, their different arithmetic paths, and
selected interval operations used for graph range analysis.
`horizon-world` adds NBT, four region compression codecs, `.mca`/`.mcc`
reading and export, saved palettes, a version-checked block-state registry,
and packed resident block sections. The world-data suite checks Rust output
with the actual vanilla NBT, region and block-state decoders on both JARs.
It covers all 35,723 exported state IDs and a 100,000-edit section trace.
[World-data commands and validation limits](world-data.md).
Scheduled ticks now support vanilla ordering, duplicate suppression, save/reload,
chunk eligibility and callback mutations. The tick suite compares 97,776 output
lines per reference JAR and checks saved block/fluid lists through vanilla codecs
and region files. [Scheduler behavior and remaining integration](scheduled-ticks.md).
Voxel shapes preserve vanilla collision tolerances, greedy box ordering, ray faces,
inside hits, and cube-versus-array cell lookup. A cached collision registry connects
imported shapes to resident block sections while checking exact state identities.
Movement helpers resolve supplied colliders and step-up candidates, including
landing adjustment and the second collider query. Movement-path block visits
preserve vanilla ordering, step indices and packed-position deduplication.
Uncached states require block behavior; the entity-context overload also needs
separate implementation. [Geometry and collision scope](collision-geometry.md).
```sh
cargo test --workspace
cargo run --release --bin voxel-bench -- 100 > .local/voxel-benchmark.csv
```
The dependency-free occupancy experiment compares scalar and bitset exposed-face counting for synthetic 16³ sections. It has no real mesh, material/AO/light work, neighboring-section context, JNI bridge or game integration. Speedups are kernel-only, not Minecraft FPS. [Research plan](optimization-plan.md) describes profiling, improved Java baselines, native integration and behavior checks before expanding scope.
Public branding and new mod downloads use **Horizon**. The existing Fabric mod
ID and `dev.horizonlab` namespace remain stable for installed instances and
measurement compatibility. The installer backs up both old `horizon-lab-*.jar`
and new `horizon-*.jar` versions before installing an update.
+4 -5
View File
@@ -60,13 +60,12 @@ The playable Java performance packs remain available during development.
The final deliverable is the complete Horizon Rust game with one-to-one parity
with pinned Java Edition 26.3, plus a playable **Linux** build that the user can
download and test. The only target machine is **ludodesktop**: Ubuntu 26.04,
Intel i7-13700KF, NVIDIA RTX 4080, GNOME on Wayland. macOS (including the M2 Pro
Mac) and Windows are out of scope. The build must include a packaged native
download and test. The target platform is a Linux x86-64 desktop with an NVIDIA
GPU (Vulkan) on Wayland. macOS and Windows are out of scope. The build must include a packaged native
executable, required runtime resources, launch instructions, artifact checksums,
and the tested OS/CPU/GPU configuration.
The build is complete only after its packaged Rust game is launched and tested on ludodesktop:
The build is complete only after its packaged Rust game is launched and tested on the target machine:
create/load a world, render terrain, use keyboard/mouse controls, move and interact,
break/place blocks, use inventory/crafting, save, quit and reload. These launch
checks accompany the full gameplay-parity suite; they do not replace it. Record
@@ -75,7 +74,7 @@ and the existing Java packs do not establish a playable Rust build.
Optimize FPS, frame pacing, memory use and render distance using matched scenes,
worlds, settings and hardware after behavior is validated. Package and test on
ludodesktop before declaring the rewrite complete. Commit and push
the target machine before declaring the rewrite complete. Commit and push
verified development checkpoints regularly.
## Implemented foundation
+5 -3
View File
@@ -1,16 +1,18 @@
Horizon server @PACK_VERSION@ — Minecraft 26.3, Fabric 0.19.5, Java 25
Install Python 3.10+ and native Java 25. Extract this ZIP and open a terminal here.
This starter never downloads the game: download the Minecraft 26.3 server jar
yourself (https://www.minecraft.net/download/server while 26.3 is current), then:
python3 tools/server.py prepare
python3 tools/server.py prepare --server-jar PATH/TO/server.jar
Read Minecraft's EULA at https://www.minecraft.net/eula. Create/edit
.local/server/optimized/eula.txt to contain eula=true if you agree, then:
python3 tools/server.py run --heap 4G
Windows: use python in place of python3 if needed. Server downloads and assets
stay in .local. No game code, third-party mod JARs or credentials are bundled.
Windows: use python in place of python3 if needed. Your server jar, mods and
assets stay in .local. No game code, third-party mod JARs or credentials are bundled.
Lithium and FerriteCore optimize the original simulation/storage; tick rate and
vanilla gameplay rules are retained. No Paper-style gameplay configuration.
+7 -3
View File
@@ -10,14 +10,18 @@ files from it.
What you need
- Minecraft Java Edition, bought and installed with the official launcher,
with version 26.3 downloaded at least once (play it once from the launcher).
- Python 3.12 or newer.
- The 26.3 server jar, downloaded yourself from
https://www.minecraft.net/en-us/download/server while 26.3 is the current
release (or from the downloads.server.url in your launcher's
versions/26.3/26.3.json). Only needed for the first start.
- Python 3.10 or newer.
- Java 25 (a JDK, e.g. Eclipse Temurin 25).
- A graphics driver with Vulkan (Linux, Windows) or any Apple Silicon Mac.
First start (once, a few minutes)
1. Open a terminal in this folder.
2. Run: python3 tools/prepare_native_client.py --prepare
(on Windows: py tools\prepare_native_client.py --prepare)
2. Run: python3 tools/prepare_native_client.py --prepare --server-jar PATH/TO/server.jar
(on Windows: py tools\prepare_native_client.py --prepare --server-jar PATH\TO\server.jar)
It reads the game files from your own Minecraft installation and writes
the resources Horizon needs into .local/ in this folder. If your launcher
keeps the game elsewhere, add --minecraft-dir PATH.
+2 -1
View File
@@ -1,8 +1,9 @@
{
"minecraft": {
"version": "26.3",
"manifest_url": "https://piston-meta.mojang.com/v1/packages/4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3/26.3.json",
"manifest_sha1": "4fe1aa1ef8da1cb95c5bad1fb98890ca56dd8ca3",
"client_sha1": "e877b6a07acd633fb3bb475002175cec036e7b87",
"server_sha1": "33680f5f2ac32864d6d7cf5e56a705fdb3e05f4c",
"java_major": 25
},
"vineflower": {
+50
View File
@@ -41,6 +41,56 @@ class ArtifactTests(unittest.TestCase):
lab.download("https://example.invalid", destination, hashlib.sha1(b"verified").hexdigest())
request.assert_not_called()
def test_import_copies_only_the_pinned_file_from_the_users_install(self):
with tempfile.TemporaryDirectory() as temp:
source, destination = Path(temp) / "own.jar", Path(temp) / "cache" / "client.jar"
source.write_bytes(b"modified")
with self.assertRaisesRegex(ValueError, "not the pinned file"):
lab.import_copy(source, destination, hashlib.sha1(b"vanilla").hexdigest())
self.assertFalse(destination.exists())
source.write_bytes(b"vanilla")
lab.import_copy(source, destination, hashlib.sha1(b"vanilla").hexdigest())
self.assertEqual(destination.read_bytes(), b"vanilla")
with self.assertRaisesRegex(FileNotFoundError, "official launcher"):
lab.import_copy(Path(temp) / "absent.jar", Path(temp) / "other.jar", "0" * 40,
hint=lab.LAUNCHER_HINT.format(version="26.3"))
def test_game_files_come_from_the_launcher_install_without_network(self):
client, server = b"client", b"server"
lock = {"minecraft": {"version": "26.3", "manifest_sha1": "0" * 40, "java_major": 25,
"client_sha1": hashlib.sha1(client).hexdigest(),
"server_sha1": hashlib.sha1(server).hexdigest()}}
manifest = {"id": "26.3", "javaVersion": {"majorVersion": 25},
"downloads": {"client": {"sha1": lock["minecraft"]["client_sha1"]},
"server": {"sha1": lock["minecraft"]["server_sha1"]}}}
with tempfile.TemporaryDirectory() as temp, mock.patch("urllib.request.urlopen") as request, \
mock.patch.dict("os.environ", {}, clear=False) as environment:
environment.pop("HORIZON_SERVER_JAR", None)
launcher, cache = Path(temp) / "minecraft", Path(temp) / "cache"
version = launcher / "versions" / "26.3"
version.mkdir(parents=True)
(version / "26.3.json").write_text(json.dumps(manifest))
(version / "26.3.jar").write_bytes(client)
loaded, jar = lab.import_client(lock, cache, launcher)
self.assertEqual((loaded["id"], jar.read_bytes()), ("26.3", client))
with self.assertRaisesRegex(FileNotFoundError, "server jar yourself"):
lab.import_server(lock, cache)
(Path(temp) / "server.jar").write_bytes(server)
self.assertEqual(lab.import_server(lock, cache, Path(temp) / "server.jar").read_bytes(), server)
self.assertEqual(lab.import_server(lock, cache).read_bytes(), server)
request.assert_not_called()
def test_launcher_manifest_for_another_release_is_rejected(self):
lock = {"minecraft": {"version": "26.3", "manifest_sha1": "0" * 40, "java_major": 25,
"client_sha1": "1" * 40, "server_sha1": "2" * 40}}
with tempfile.TemporaryDirectory() as temp:
version = Path(temp) / "versions" / "26.3"
version.mkdir(parents=True)
(version / "26.3.json").write_text(json.dumps({"id": "26.3", "downloads": {
"client": {"sha1": "3" * 40}, "server": {"sha1": "2" * 40}}}))
with self.assertRaisesRegex(ValueError, "pinned 26.3 release"):
lab.import_manifest(lock, Path(temp) / "cache", Path(temp))
def test_sourcefile_metadata_covers_inner_classes(self):
with tempfile.TemporaryDirectory() as temp:
path = Path(temp) / "game.jar"
+3
View File
@@ -14,6 +14,9 @@ class ParityTests(unittest.TestCase):
scores = [float(score) for score in re.findall(r'^\| [^|]+ \| (0|0\.25|0\.5|0\.75|1) \| [^|]+ \|$', table, re.MULTILINE)]
self.assertEqual(len(scores), table.count('\n|') - 1, 'Every row needs a score of 0, 0.25, 0.5, 0.75 or 1')
self.assertEqual(int(heading.group(1)), round(sum(scores) * 100 / len(scores)))
badge = re.search(r'badge/vanilla%20parity-(\d+)%25-', text)
self.assertIsNotNone(badge, 'README parity badge is missing')
self.assertEqual(badge.group(1), heading.group(1), 'The parity badge must match the table')
if __name__ == '__main__':
+22 -45
View File
@@ -1,23 +1,15 @@
#!/usr/bin/env python3
"""Fetch the pinned version's indexed client assets that are not in the game
jar: language files and the language list (pack.mcmeta), the unifont glyph
archives and their font definitions, and the built-in Programmer Art and High
Contrast resource packs. Every object's SHA-1 is verified. Files go to the
private client resource directory (or --target) and are never committed."""
"""Copy the pinned version's indexed client assets that are not in the game
jar from your own official launcher install: language files and the language
list (pack.mcmeta), the unifont glyph archives and their font definitions, and
the built-in Programmer Art and High Contrast resource packs. Every object's
SHA-1 is verified. Nothing is downloaded; files go to the private client
resource directory (or --target) and are never committed."""
import argparse
import concurrent.futures
import hashlib
import json
from pathlib import Path
import urllib.request
import shutil
ROOT = Path(__file__).resolve().parent.parent
LOCAL = ROOT / '.local'
def fetch(url):
with urllib.request.urlopen(url, timeout=120) as response:
return response.read()
import lab
def wanted(name):
@@ -29,40 +21,25 @@ def wanted(name):
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--target', type=Path, default=LOCAL / 'horizon-client/26.3',
parser.add_argument('--target', type=Path, default=lab.LOCAL / 'horizon-client/26.3',
help='prepared resource directory (default: .local/horizon-client/26.3)')
parser.add_argument('--minecraft-dir', type=Path,
help="official launcher game directory (default: the launcher's own)")
args = parser.parse_args()
manifest = json.loads((LOCAL / 'minecraft/26.3/manifest.json').read_text())
index_info = manifest['assetIndex']
lock, directory = lab.config()
manifest = lab.import_manifest(lock, directory, args.minecraft_dir)
store, index = lab.launcher_assets(manifest, args.minecraft_dir)
target = args.target
index_path = target / 'asset-index.json'
if not index_path.exists() or hashlib.sha1(index_path.read_bytes()).hexdigest() != index_info['sha1']:
data = fetch(index_info['url'])
if hashlib.sha1(data).hexdigest() != index_info['sha1']:
raise ValueError('asset index checksum mismatch')
target.mkdir(parents=True, exist_ok=True)
index_path.write_bytes(data)
objects = json.loads(index_path.read_text())['objects']
target.mkdir(parents=True, exist_ok=True)
shutil.copyfile(index, target / 'asset-index.json')
objects = lab.json.loads(index.read_text())['objects']
selected = {name: info for name, info in objects.items() if wanted(name)}
def download(item):
name, info = item
path = target / 'assets' / name
if path.exists() and hashlib.sha1(path.read_bytes()).hexdigest() == info['hash']:
return 0
h = info['hash']
data = fetch(f'https://resources.download.minecraft.net/{h[:2]}/{h}')
if hashlib.sha1(data).hexdigest() != h:
raise ValueError(f'checksum mismatch for {name}')
path.parent.mkdir(parents=True, exist_ok=True)
path.write_bytes(data)
return len(data)
total = 0
with concurrent.futures.ThreadPoolExecutor(16) as pool:
for size in pool.map(download, selected.items()):
total += size
print(f'Client assets ready: {len(selected)} files, {total / 1e6:.1f} MB downloaded')
for name, info in selected.items():
source = lab.launcher_object(store, info['hash'])
lab.import_copy(source, target / 'assets' / name, info['hash'])
total += info['size']
print(f'Client assets ready: {len(selected)} files, {total / 1e6:.1f} MB')
if __name__ == '__main__':
+23 -42
View File
@@ -1,54 +1,35 @@
#!/usr/bin/env python3
"""Fetch the pinned version's sound assets (sounds.json and .ogg files) from
Mojang's asset index into the private client resource directory, verifying
every object's SHA-1. The files stay in ignored .local/ and are never committed."""
import concurrent.futures
import hashlib
import json
"""Copy the pinned version's sound assets (sounds.json and .ogg files) from your
own official launcher install into the private client resource directory,
verifying every object's SHA-1. Nothing is downloaded; the files stay in
ignored .local/ and are never committed."""
import argparse
from pathlib import Path
import urllib.request
import shutil
ROOT = Path(__file__).resolve().parent.parent
LOCAL = ROOT / '.local'
def fetch(url):
with urllib.request.urlopen(url, timeout=120) as response:
return response.read()
import lab
def main():
manifest = json.loads((LOCAL / 'minecraft/26.3/manifest.json').read_text())
index_info = manifest['assetIndex']
target = LOCAL / 'horizon-client/26.3'
index_path = target / 'asset-index.json'
if not index_path.exists() or hashlib.sha1(index_path.read_bytes()).hexdigest() != index_info['sha1']:
data = fetch(index_info['url'])
if hashlib.sha1(data).hexdigest() != index_info['sha1']:
raise ValueError('asset index checksum mismatch')
index_path.write_bytes(data)
objects = json.loads(index_path.read_text())['objects']
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--minecraft-dir', type=Path,
help="official launcher game directory (default: the launcher's own)")
args = parser.parse_args()
lock, directory = lab.config()
manifest = lab.import_manifest(lock, directory, args.minecraft_dir)
store, index = lab.launcher_assets(manifest, args.minecraft_dir)
target = lab.LOCAL / 'horizon-client' / manifest['id']
target.mkdir(parents=True, exist_ok=True)
shutil.copyfile(index, target / 'asset-index.json')
objects = lab.json.loads(index.read_text())['objects']
wanted = {name: info for name, info in objects.items()
if name == 'minecraft/sounds.json' or name.startswith('minecraft/sounds/')}
def download(item):
name, info = item
path = target / 'assets' / name
if path.exists() and hashlib.sha1(path.read_bytes()).hexdigest() == info['hash']:
return 0
h = info['hash']
data = fetch(f'https://resources.download.minecraft.net/{h[:2]}/{h}')
if hashlib.sha1(data).hexdigest() != h:
raise ValueError(f'checksum mismatch for {name}')
path.parent.mkdir(parents=True, exist_ok=True)
path.write_bytes(data)
return len(data)
total = 0
with concurrent.futures.ThreadPoolExecutor(16) as pool:
for size in pool.map(download, wanted.items()):
total += size
print(f'Sound assets ready: {len(wanted)} files, {total / 1e6:.1f} MB downloaded')
for name, info in wanted.items():
source = lab.launcher_object(store, info['hash'])
lab.import_copy(source, target / 'assets' / name, info['hash'])
total += info['size']
print(f'Sound assets ready: {len(wanted)} files, {total / 1e6:.1f} MB')
if __name__ == '__main__':
+136 -27
View File
@@ -1,9 +1,10 @@
#!/usr/bin/env python3
"""Pinned Java Edition acquisition/decompilation. All generated files stay in .local/."""
"""Pinned Java Edition import/decompilation. Game files come from the user's own
copy (their official launcher install and the server jar they downloaded); all
generated files stay in .local/."""
import argparse
from collections import Counter
from concurrent.futures import ThreadPoolExecutor
import hashlib
import json
import os
@@ -59,6 +60,124 @@ def download(url, destination, checksum, algorithm="sha1"):
return destination
LAUNCHER_HINT = ("Horizon does not download the game: install Minecraft Java Edition with the official "
"launcher, play {version} once, then rerun. If the launcher uses another game directory, "
"pass --minecraft-dir or set HORIZON_MINECRAFT_DIR.")
SERVER_HINT = ("Horizon does not download the game: download the {version} server jar yourself (minecraft.net/download/server "
"while {version} is the current release, otherwise the downloads.server.url in your launcher's "
"versions/{version}/{version}.json), then pass --server-jar PATH or set HORIZON_SERVER_JAR.")
def minecraft_dir(override=None):
"""The official launcher's game directory, which holds the user's own copy of the game."""
if override or os.environ.get("HORIZON_MINECRAFT_DIR"):
return Path(override or os.environ["HORIZON_MINECRAFT_DIR"]).expanduser()
if sys.platform == "darwin":
return Path.home() / "Library" / "Application Support" / "minecraft"
if sys.platform == "win32":
return Path(os.environ.get("APPDATA", Path.home())) / ".minecraft"
return Path.home() / ".minecraft"
def import_copy(source, destination, checksum, algorithm="sha1", hint=""):
"""Copy one file from the user's own install, verified like a download."""
destination.parent.mkdir(parents=True, exist_ok=True)
if destination.exists() and digest(destination, algorithm) == checksum:
return destination
if not source.is_file():
raise FileNotFoundError(f"Missing {source}. {hint}".strip())
actual = digest(source, algorithm)
if actual != checksum:
raise ValueError(f"{source} is not the pinned file: expected {algorithm} {checksum}, got {actual}")
with tempfile.NamedTemporaryFile(dir=destination.parent, delete=False) as stream:
temporary = Path(stream.name)
try:
shutil.copyfile(source, temporary)
temporary.replace(destination)
finally:
temporary.unlink(missing_ok=True)
return destination
def import_manifest(lock, directory, minecraft=None):
"""The pinned version JSON, from the launcher's versions/ directory."""
game = lock["minecraft"]
version = game["version"]
destination = directory / "manifest.json"
source = minecraft_dir(minecraft) / "versions" / version / f"{version}.json"
if not (destination.exists() and digest(destination, "sha1") == game["manifest_sha1"]):
if not source.is_file():
raise FileNotFoundError(f"Missing {source}. {LAUNCHER_HINT.format(version=version)}")
manifest = json.loads(source.read_text(encoding="utf-8"))
downloads = manifest.get("downloads", {})
if (manifest.get("id") != version
or downloads.get("client", {}).get("sha1") != game["client_sha1"]
or downloads.get("server", {}).get("sha1") != game["server_sha1"]):
raise ValueError(f"{source} does not describe the pinned {version} release")
destination.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(source, destination)
manifest = json.loads(destination.read_text(encoding="utf-8"))
if manifest["javaVersion"]["majorVersion"] != game["java_major"]:
raise ValueError("Manifest Java version does not match lock file")
return manifest
def import_client(lock, directory, minecraft=None):
"""The user's client jar from their launcher install, checked against the lock."""
version = lock["minecraft"]["version"]
manifest = import_manifest(lock, directory, minecraft)
source = minecraft_dir(minecraft) / "versions" / version / f"{version}.jar"
jar = import_copy(source, directory / "jars" / "client.jar", lock["minecraft"]["client_sha1"],
hint=LAUNCHER_HINT.format(version=version))
return manifest, jar
def import_server(lock, directory, server_jar=None):
"""The server jar the user downloaded themselves, checked against the lock."""
version = lock["minecraft"]["version"]
destination = directory / "jars" / "server.jar"
checksum = lock["minecraft"]["server_sha1"]
source = server_jar or os.environ.get("HORIZON_SERVER_JAR")
hint = SERVER_HINT.format(version=version)
if source is None:
if destination.exists() and digest(destination, "sha1") == checksum:
return destination
raise FileNotFoundError(f"No {version} server jar. {hint}")
return import_copy(Path(source).expanduser(), destination, checksum, hint=hint)
def import_library(artifact, destination_root, minecraft=None):
"""One library jar from the launcher's libraries/ directory."""
relative = PurePosixPath(artifact["path"])
if relative.is_absolute() or ".." in relative.parts or "\\" in artifact["path"]:
raise ValueError("Unsafe library path")
source = minecraft_dir(minecraft) / "libraries" / relative
hint = LAUNCHER_HINT.format(version=json.loads(LOCK.read_text(encoding="utf-8"))["minecraft"]["version"])
return import_copy(source, destination_root / relative, artifact["sha1"], hint=hint)
def launcher_assets(manifest, minecraft=None):
"""The launcher's asset directory and the pinned version's verified asset index."""
assets = minecraft_dir(minecraft) / "assets"
info = manifest["assetIndex"]
index = assets / "indexes" / f"{info['id']}.json"
if not index.is_file():
raise FileNotFoundError(f"Missing {index}. {LAUNCHER_HINT.format(version=manifest['id'])}")
if digest(index, "sha1") != info["sha1"]:
raise ValueError(f"{index} is not the pinned asset index")
return assets, index
def launcher_object(assets, checksum):
"""One verified object from the launcher's asset store."""
path = assets / "objects" / checksum[:2] / checksum
if not path.is_file():
raise FileNotFoundError(f"Missing asset object {path}. Play the pinned version once in the official launcher.")
if digest(path, "sha1") != checksum:
raise ValueError(f"Corrupt asset object {path}; let the launcher repair it")
return path
def config():
lock = json.loads(LOCK.read_text(encoding="utf-8"))
version = lock["minecraft"]["version"]
@@ -180,35 +299,18 @@ def inventory(jar):
"packages": dict(packages.most_common()), "classes": classes}
def prepare():
def prepare(minecraft=None, server_jar=None):
lock, directory = config()
minecraft = lock["minecraft"]
manifest_path = download(minecraft["manifest_url"], directory / "manifest.json",
minecraft["manifest_sha1"])
manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
if manifest["id"] != minecraft["version"]:
raise ValueError("Manifest version does not match lock file")
manifest, client = import_client(lock, directory, minecraft)
if "client_mappings" in manifest["downloads"] or "server_mappings" in manifest["downloads"]:
raise ValueError("This workflow targets unobfuscated releases. Older releases need a remapping stage.")
if manifest["javaVersion"]["majorVersion"] != minecraft["java_major"]:
raise ValueError("Manifest Java version does not match lock file")
jars = {}
for side in ["client", "server"]:
artifact = manifest["downloads"][side]
print(f"Preparing {side} {manifest['id']}...", flush=True)
jars[side] = download(artifact["url"], directory / "jars" / f"{side}.jar", artifact["sha1"])
print(f"Imported client {manifest['id']} from {minecraft_dir(minecraft)}", flush=True)
jars = {"client": client, "server": import_server(lock, directory, server_jar)}
jars["server"], server_libraries = unpack_server(jars["server"], directory, manifest["id"])
client_artifacts = [library["downloads"]["artifact"] for library in manifest["libraries"]
if "artifact" in library.get("downloads", {})]
def client_library(artifact):
relative = PurePosixPath(artifact["path"])
if relative.is_absolute() or ".." in relative.parts or "\\" in artifact["path"]:
raise ValueError("Unsafe library path")
return download(artifact["url"], directory / "libraries" / "client" / relative, artifact["sha1"])
with ThreadPoolExecutor(max_workers=4) as pool:
client_libraries = list(pool.map(client_library, client_artifacts))
client_libraries = [import_library(artifact, directory / "libraries" / "client", minecraft)
for artifact in client_artifacts]
vf = lock["vineflower"]
download(vf["url"], LOCAL / "tools" / f"vineflower-{vf['version']}.jar", vf["sha256"], "sha256")
for side, jar in jars.items():
@@ -297,10 +399,17 @@ def status():
return 2 if incomplete else 0
def add_game_arguments(parser):
parser.add_argument("--minecraft-dir", type=Path,
help="official launcher game directory with your installed copy (default: the launcher's own)")
parser.add_argument("--server-jar", type=Path, help="the pinned server jar you downloaded yourself")
def main():
parser = argparse.ArgumentParser(description=__doc__)
commands = parser.add_subparsers(dest="command", required=True)
commands.add_parser("prepare", help="Download pinned official JARs, libraries, and decompiler; inventory classes")
preparer = commands.add_parser("prepare", help="Import your own pinned game files, fetch the decompiler; inventory classes")
add_game_arguments(preparer)
decompiler = commands.add_parser("decompile", help="Decompile locally and check source-file coverage")
decompiler.add_argument("--side", choices=["client", "server", "both"], default="both")
decompiler.add_argument("--java", default="java")
@@ -314,7 +423,7 @@ def main():
parser.error("--heap must look like 6G or 512M")
try:
if args.command == "prepare":
prepare()
prepare(args.minecraft_dir, args.server_jar)
return 0
if args.command == "decompile":
return decompile(args)
+2 -1
View File
@@ -33,7 +33,7 @@ Type=Application
Name=Horizon
Comment=Minecraft Java Edition 26.3 in Rust
Exec="$here/horizon.sh"
Icon=$here/resources/assets/minecraft/textures/block/grass_block_side.png
Icon=$here/horizon.png
Terminal=false
Categories=Game;
EOF
@@ -103,6 +103,7 @@ def main():
with tarfile.open(archive, 'w:gz', compresslevel=1) as tar:
tar.add(args.binary, 'horizon/horizon-client')
add_bytes(tar, 'horizon/horizon.sh', LAUNCHER.encode(), 0o755)
tar.add(ROOT / 'docs/media/icon-256.png', 'horizon/horizon.png')
add_bytes(tar, 'horizon/README.txt', README.format(version=version, commit=commit, platform=plat).encode())
for path in sorted(args.resources.iterdir()):
if path.name not in SKIP:
+4 -2
View File
@@ -141,10 +141,12 @@ def prepare_worldgen(root, jars, local, libraries=None):
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--prepare', action='store_true', help='Fetch pinned reference artifacts first')
parser.add_argument('--prepare', action='store_true',
help='Import the pinned game files from your own copy first')
lab.add_game_arguments(parser)
args = parser.parse_args()
if args.prepare:
lab.prepare()
lab.prepare(args.minecraft_dir, args.server_jar)
lock, jars, libraries = base.verify_artifacts()
root = lab.LOCAL / 'horizon-client' / lock['minecraft']['version']
root.mkdir(parents=True, exist_ok=True)
+11 -20
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Prepare an isolated, authenticated-by-launcher game runtime; local smoke tests use demo mode."""
"""Prepare an isolated game runtime from your own launcher install; local smoke tests use demo mode."""
from concurrent.futures import ThreadPoolExecutor
import argparse
@@ -120,14 +120,10 @@ def native_library_matches(library, architecture=None):
def prepare_client(assets=True):
"""Classpath and natives from the user's own launcher install; nothing of the game is downloaded."""
lock, directory = lab.config()
game = lock["minecraft"]
manifest_file = fetch(game["manifest_url"], directory / "manifest.json", game["manifest_sha1"])
manifest = json.loads(manifest_file.read_text())
if manifest["id"] != game["version"] or manifest["javaVersion"]["majorVersion"] != game["java_major"]:
raise ValueError("Game manifest does not match research lock")
artifact = manifest["downloads"]["client"]
jars = [fetch(artifact["url"], directory / "jars/client.jar", artifact["sha1"])]
manifest, client = lab.import_client(lock, directory)
jars = [client]
natives = CACHE / "natives"
natives.mkdir(parents=True, exist_ok=True)
for library in manifest["libraries"]:
@@ -136,7 +132,7 @@ def prepare_client(assets=True):
artifact = library.get("downloads", {}).get("artifact")
if not artifact:
continue
jar = fetch(artifact["url"], directory / "libraries/client" / artifact["path"], artifact["sha1"])
jar = lab.import_library(artifact, directory / "libraries/client")
jars.append(jar)
with zipfile.ZipFile(jar) as archive:
for name in archive.namelist():
@@ -144,16 +140,11 @@ def prepare_client(assets=True):
(natives / Path(name).name).write_bytes(archive.read(name))
jars.extend(fabric_libraries())
if assets:
info = manifest["assetIndex"]
index = fetch(info["url"], CACHE / "assets/indexes" / f"{info['id']}.json", info["sha1"])
objects = json.loads(index.read_text())["objects"]
unique = {v["hash"] for v in objects.values()}
def asset(checksum):
return fetch(f"https://resources.download.minecraft.net/{checksum[:2]}/{checksum}",
CACHE / "assets/objects" / checksum[:2] / checksum, checksum)
print(f"Verifying/downloading {len(unique)} unique game assets...", flush=True)
with ThreadPoolExecutor(max_workers=12) as pool:
list(pool.map(asset, sorted(unique)))
store, index = lab.launcher_assets(manifest)
unique = {v["hash"] for v in json.loads(index.read_text())["objects"].values()}
print(f"Verifying {len(unique)} game assets in {store}...", flush=True)
with ThreadPoolExecutor(max_workers=4) as pool:
list(pool.map(lambda checksum: lab.launcher_object(store, checksum), sorted(unique)))
return manifest, jars, natives
@@ -179,7 +170,7 @@ def main():
"-Dfabric.log.disableAnsi=true", "-cp", os.pathsep.join(map(str, jars)),
"net.fabricmc.loader.impl.launch.knot.KnotClient",
"--username", "HorizonDemo", "--version", manifest["id"], "--gameDir", str(instance),
"--assetsDir", str(CACHE / "assets"), "--assetIndex", manifest["assetIndex"]["id"],
"--assetsDir", str(lab.minecraft_dir() / "assets"), "--assetIndex", manifest["assetIndex"]["id"],
"--accessToken", "0", "--uuid", "00000000000000000000000000000000", "--demo",
"--width", "1280", "--height", "800"]
subprocess.run(command, cwd=instance, check=True)
+5 -8
View File
@@ -18,14 +18,10 @@ except ImportError:
ROOT = lab.ROOT
def prepare(instance, baseline=False):
def prepare(instance, baseline=False, server_jar=None):
lock, directory = lab.config()
game = lock["minecraft"]
manifest_file = runtime.fetch(game["manifest_url"], directory / "manifest.json", game["manifest_sha1"])
manifest = json.loads(manifest_file.read_text())
artifact = manifest["downloads"]["server"]
launcher = runtime.fetch(artifact["url"], directory / "jars/server.jar", artifact["sha1"])
server, libraries = lab.unpack_server(launcher, directory, game["version"])
launcher = lab.import_server(lock, directory, server_jar)
server, libraries = lab.unpack_server(launcher, directory, lock["minecraft"]["version"])
libraries = [server, *libraries, *runtime.fabric_libraries()]
pack_lock = json.loads((ROOT / "packs/mods.lock.json").read_text())
mods = pack_lock["projects"]
@@ -49,6 +45,7 @@ def main():
parser.add_argument("command", choices=["prepare", "run"])
parser.add_argument("--instance", type=Path, default=ROOT / ".local/server/optimized")
parser.add_argument("--heap", default="4G")
parser.add_argument("--server-jar", type=Path, help="the pinned server jar you downloaded yourself")
parser.add_argument("--baseline", action="store_true", help="Use a separate instance for the baseline")
parser.add_argument("--compact-headers", action="store_true", help="Enable Java 25 compact object headers for this server process")
parser.add_argument("--gc", choices=["default", "g1", "zgc"], default="default", help="Select a collector for this process; default leaves JVM policy in use")
@@ -58,7 +55,7 @@ def main():
instance = args.instance.resolve()
if args.baseline and args.instance == parser.get_default("instance"):
instance = ROOT / ".local/server/baseline"
libraries = prepare(instance, args.baseline)
libraries = prepare(instance, args.baseline, args.server_jar)
if args.command == "prepare":
print(f"Prepared server at {instance}. Read https://www.minecraft.net/eula before setting eula=true locally.")
return