Build Horizon on Windows and package playable folders

The control socket reports itself unavailable on Windows, which has no
Unix domain sockets, and horizon-ctl uses the same stream type. A release
workflow builds the Windows client by hand; packaging/package.sh assembles
the binary, the resource preparation tool and PLAY.txt, without any of
Minecraft's files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-12 18:58:25 +02:00
parent c51bfda80c
commit 222345b5d1
5 changed files with 124 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
name: release builds
# Started by hand: gh workflow run release.yml --ref <branch>
# Builds the Windows x64 client and uploads the playable folder as an artifact.
# Linux and macOS builds are made on the development machines.
on:
workflow_dispatch:
permissions:
contents: read
jobs:
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: rustup toolchain install stable --profile minimal
- name: Build the client
run: cargo +stable build --release --locked -p horizon-client --bin horizon-client
- name: Package
shell: bash
run: packaging/package.sh target/release/horizon-client.exe dist/horizon-windows-x64
- uses: actions/upload-artifact@v4
with:
name: horizon-windows-x64
path: dist/horizon-windows-x64
+2 -1
View File
@@ -2,13 +2,14 @@
#![forbid(unsafe_code)]
use std::{
io::{BufRead, BufReader, Write},
os::unix::net::UnixStream,
path::{Path, PathBuf},
process::{Command, ExitCode, Stdio},
thread,
time::{Duration, Instant},
};
use horizon_client::control::UnixStream;
const USAGE: &str = "usage: horizon-ctl [--socket PATH] COMMAND [ARGS...]
Local commands:
+50 -1
View File
@@ -5,12 +5,61 @@
//! that depend on a later frame (screenshots, benchmarks) arrive when ready.
use std::{
io::{BufRead, BufReader, Write},
os::unix::net::{UnixListener, UnixStream},
path::{Path, PathBuf},
sync::mpsc,
thread,
};
#[cfg(unix)]
pub use std::os::unix::net::{UnixListener, UnixStream};
#[cfg(not(unix))]
pub use unsupported::{UnixListener, UnixStream};
/// Windows' standard library has no Unix domain sockets: there the control
/// socket reports itself unavailable and the game runs without it.
#[cfg(not(unix))]
mod unsupported {
use std::{io, path::Path};
fn unavailable() -> io::Error {
io::Error::new(
io::ErrorKind::Unsupported,
"the control socket needs Unix domain sockets (Linux or macOS)",
)
}
pub struct UnixStream;
impl UnixStream {
pub fn connect<P: AsRef<Path>>(_: P) -> io::Result<Self> {
Err(unavailable())
}
pub fn try_clone(&self) -> io::Result<Self> {
Err(unavailable())
}
}
impl io::Read for UnixStream {
fn read(&mut self, _: &mut [u8]) -> io::Result<usize> {
Err(unavailable())
}
}
impl io::Write for UnixStream {
fn write(&mut self, _: &[u8]) -> io::Result<usize> {
Err(unavailable())
}
fn flush(&mut self) -> io::Result<()> {
Ok(())
}
}
pub struct UnixListener;
impl UnixListener {
pub fn bind<P: AsRef<Path>>(_: P) -> io::Result<Self> {
Err(unavailable())
}
pub fn incoming(&self) -> std::iter::Empty<io::Result<UnixStream>> {
std::iter::empty()
}
}
}
/// One command line from a client, with the channel for its JSON reply.
pub struct Request {
pub line: String,
+35
View File
@@ -0,0 +1,35 @@
Horizon: Minecraft Java Edition 26.3, rewritten in Rust
=========================================================
Horizon is an unofficial fan project, not affiliated with, endorsed by or
connected to Mojang Studios or Microsoft. Minecraft is a trademark of Mojang
and Microsoft. This package contains none of Minecraft's code, textures or
sounds: you need your own copy of Minecraft Java Edition, and Horizon uses the
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.
- 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)
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.
Play
Linux: ./horizon-client
macOS: ./horizon-client (first time: right-click > Open, or
xattr -d com.apple.quarantine horizon-client)
Windows: horizon-client.exe
Run it from this folder. horizon-client --help lists the options
(render distance, world, seed, joining a server...).
Controls: mouse look, WASD move, Space jump, Left Shift sneak, Left Ctrl
sprint, left click break, right click place/use, 1-9 or scroll for the hotbar,
E inventory, Q drop, F1 hide the HUD, F3 debug, Esc pause.
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# packaging/package.sh BINARY OUTDIR: a playable Horizon folder with the game
# binary, the resource preparation tool and what it compiles, and PLAY.txt.
# It holds none of Minecraft's files: players prepare those from their own copy.
set -euo pipefail
bin=$1
out=$2
repo=$(git -C "$(dirname "$0")" rev-parse --show-toplevel)
rm -rf "$out"
mkdir -p "$out"
git -C "$repo" archive HEAD tools mods/horizon/src/test/java research-lock.json LICENSE | tar -x -C "$out"
cp "$bin" "$out/"
cp "$repo/packaging/PLAY.txt" "$out/PLAY.txt"