Merge remote-tracking branch 'origin/main' into feat/native-material-stage
# Conflicts: # docs/shaders.md
This commit is contained in:
@@ -21,7 +21,7 @@ Level: preview ([stability.md](stability.md)). Schema 1.
|
||||
"license": "MIT", "source": "https://github.com/...", "icon": "https://...png", "key": "RWT...",
|
||||
"versions": [{
|
||||
"version": "0.1.0", "published": "2026-10-24", "changelog": "",
|
||||
"api": "0.1", "side": "client", "capabilities": ["game-read", "hud", "chat"], "game": "26.3",
|
||||
"api": "0.1", "side": "client", "capabilities": ["game-read", "hud", "chat"], "api_level": 0, "game": "26.3",
|
||||
"file": { "name": "coords_hud-0.1.0.hmod", "url": "https://github.com/ludovic111/horizon-mods/releases/download/...",
|
||||
"size": 438, "sha256": "e113...", "signature": "untrusted comment: ...\n...\ntrusted comment: ...\n...\n" }
|
||||
}]
|
||||
@@ -43,6 +43,7 @@ Level: preview ([stability.md](stability.md)). Schema 1.
|
||||
| `versions` | Newest first, at least one. |
|
||||
| `api` | A mod's API line (its manifest's `api`); a modpack's manifest format (`1`). |
|
||||
| `side`, `capabilities` | A mod's, read from its manifest by CI, never typed by hand. |
|
||||
| `api_level` | The mod API level a mod's code needs ([stability.md](stability.md#mod-api-levels)): its newest imported function's, read from the file by CI. Absent for content-only mods and in indexes built before levels. Installers take the newest version whose level the running game serves. |
|
||||
| `game` | The Minecraft version it is for. |
|
||||
| `requires` | A modpack's mods: `{ id, version, sha256 }`, each a version in this index with that hash. |
|
||||
| `file` | A plain name with the kind's extension (`.hmod`, `.hpack`, `.zip`), an `https://` URL, the size (at most 64 MiB), the lowercase hex SHA-256, and the `.minisig` text when the project has a key. |
|
||||
@@ -57,9 +58,11 @@ changing what one means, makes schema 2.
|
||||
|
||||
1. Its size and SHA-256 are the ones the entry lists, and it isn't revoked.
|
||||
2. With a project key: its signature verifies with that key (minisign's prehashed and legacy signatures both).
|
||||
3. What the file says matches the entry: a mod's `horizon-mod.toml` (id, version, API, side, capabilities) and its
|
||||
3. What the file says matches the entry: a mod's `horizon-mod.toml` (id, version, API, side, capabilities), its API
|
||||
level when the entry lists one, and its
|
||||
content's fence ([mods.md](../mods.md#content-mods-api-02)); a modpack's manifest (id, version, format, game,
|
||||
mods); a resource pack's `pack.mcmeta`.
|
||||
mods); a resource pack's `pack.mcmeta`; a shader pack's `horizon_shader_api::check` and manifest (id, version,
|
||||
shader API).
|
||||
4. A kind this build can't install is refused with "this Horizon can't install a … yet".
|
||||
|
||||
The game still checks a mod's component imports against its capabilities when it starts it, as for any mod.
|
||||
@@ -164,5 +167,6 @@ opens.
|
||||
|
||||
## Changelog
|
||||
|
||||
- 2026-10-26: the launcher installs `shader` files into `shaderpacks/`; the sample index lists one (`glow`).
|
||||
- 2026-10-25: `shader` opens, checked by `horizon_shader_api::check`; its files are `.hshader`.
|
||||
- Schema 1 (2026-10-24): kinds `mod`, `modpack`, `resourcepack`, `shader`; `.hpack` format 1.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!-- Generated from crates/horizon-mod-sdk/wit/horizon.wit and the manifest's capabilities by crates/horizon-mods/tests/api_reference.rs; a test fails when this file is out of date. Update it with: HORIZON_WRITE_DOCS=1 cargo test -p horizon-mods --features pack --test api_reference -->
|
||||
# Mod API reference
|
||||
|
||||
The contract between Horizon and its mods: the WIT package `horizon:mods@0.1.0`, every interface, type, function and hook in it, and the capabilities a manifest may list. The guide is [mods.md](../mods.md); stability and versions: [stability.md](stability.md). Manifest `api` lines this game serves: `0.1`, `0.2`.
|
||||
The contract between Horizon and its mods: the WIT package `horizon:mods@0.1.0`, every interface, type, function and hook in it, and the capabilities a manifest may list. The guide is [mods.md](../mods.md); stability and versions: [stability.md](stability.md). Manifest `api` lines this game serves: `0.1`, `0.2`, `0.3`.
|
||||
|
||||
## Capabilities
|
||||
|
||||
@@ -16,12 +16,22 @@ The contract between Horizon and its mods: the WIT package `horizon:mods@0.1.0`,
|
||||
| `ui` | [`ui`](#ui) | show its own screens and a settings page |
|
||||
| `render` | [`render`](#render) | draw on your screen, shake and zoom the camera |
|
||||
| `input` | [`input`](#input) | see the keys you hold and your clicks, take over the use button on its own items and the mouse wheel, and add keys |
|
||||
| `players` | [`players`](#players) | see who is on the server and message them |
|
||||
|
||||
## World `horizon-mod`
|
||||
|
||||
A client mod: runs in the player's game.
|
||||
|
||||
- Imports (what the game offers): `log`, `game`, `chat`, `hud`, `storage`, `command`
|
||||
- Exports (what the mod provides): `events`
|
||||
|
||||
## World `horizon-server-mod`
|
||||
|
||||
A server mod (manifest `side = "server"`, `api = "0.3"`, experimental): runs where the world is simulated, on the dedicated server, a LAN host and single player's own server.
|
||||
|
||||
- Imports (what the game offers): `log`, `storage`, `players`
|
||||
- Exports (what the mod provides): `server-events`
|
||||
|
||||
## World `horizon-ui-mod`
|
||||
|
||||
A mod with widgets (capability `ui`): the SDK builds every mod against this world. Mods built for `horizon-mod` alone (no `ui-events` export) still load and simply hear nothing of their widgets.
|
||||
@@ -434,3 +444,76 @@ What the game calls. Only the hooks `init` asks for are ever called.
|
||||
| `frame` | `func(seconds: f32)` | Each rendered frame, with the seconds since the last one. |
|
||||
| `command` | `func(name: string, args: string) -> result<option<string>, string>` | `/name args`: ok(some(text)) is shown as feedback, err(text) in red. |
|
||||
| `chat` | `func(text: string)` | Each chat line the player receives, as plain text. |
|
||||
|
||||
## `players`
|
||||
|
||||
Access: capability `players`.
|
||||
|
||||
Capability `players`, server mods only (manifest `api = "0.3"`, experimental): the players on the server, and messages to them.
|
||||
|
||||
### enum `game-mode`
|
||||
|
||||
| Case | |
|
||||
| --- | --- |
|
||||
| `survival` | |
|
||||
| `creative` | |
|
||||
| `adventure` | |
|
||||
| `spectator` | |
|
||||
|
||||
### record `player`
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `id` | `string` | The player's UUID, `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`. |
|
||||
| `name` | `string` | |
|
||||
| `x` | `f64` | Feet position, in blocks. |
|
||||
| `y` | `f64` | |
|
||||
| `z` | `f64` | |
|
||||
| `dimension` | `string` | `minecraft:overworld`, `minecraft:the_nether`, ... |
|
||||
| `game-mode` | `game-mode` | |
|
||||
| `health` | `f32` | Hit points as vanilla counts them: 20 is full health without effects. |
|
||||
|
||||
| Function | Signature | What it does |
|
||||
| --- | --- | --- |
|
||||
| `online` | `func() -> list<player>` | The players online, in the order they joined. |
|
||||
| `tell` | `func(player: string, text: string) -> bool` | A system message to one player, after the mod's name; false when no player with that id is online. Up to 8 messages per call. |
|
||||
| `broadcast` | `func(text: string)` | A system message to every player and the server's log, after the mod's name. Counts toward the same 8 per call. |
|
||||
|
||||
## `server-events`
|
||||
|
||||
Access: exported by the mod: the game calls it.
|
||||
|
||||
What the server calls in a server mod (manifest `api = "0.3"`, experimental). Only the hooks `init` asks for are ever called. The player in each event is as the server saw them when it happened.
|
||||
|
||||
### type `player`
|
||||
|
||||
`type player = player`
|
||||
|
||||
### record `registration`
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `commands` | `list<string>` | Commands players may type, without the slash. A name vanilla already uses is refused (vanilla's command runs). |
|
||||
| `tick` | `bool` | Call `tick` every server tick (20 per second). |
|
||||
| `joins` | `bool` | Call `player-joined` and `player-left`. |
|
||||
| `chat` | `bool` | Call `chat` for each chat message a player sends. |
|
||||
| `blocks` | `bool` | Call `block-broken` and `block-placed`. |
|
||||
|
||||
### record `block-pos`
|
||||
|
||||
| Field | Type | |
|
||||
| --- | --- | --- |
|
||||
| `x` | `s32` | |
|
||||
| `y` | `s32` | |
|
||||
| `z` | `s32` | |
|
||||
|
||||
| Function | Signature | What it does |
|
||||
| --- | --- | --- |
|
||||
| `init` | `func() -> result<registration, string>` | Once, after loading. An error keeps the mod off and is logged. |
|
||||
| `tick` | `func(tick: u64)` | Each server tick, with the server's tick counter. |
|
||||
| `player-joined` | `func(player: player)` | A player joined the server; they are in `players.online` already. |
|
||||
| `player-left` | `func(player: player)` | A player left the server; they are no longer in `players.online`. |
|
||||
| `chat` | `func(player: player, text: string)` | A chat message a player sent, as plain text. |
|
||||
| `command` | `func(player: player, name: string, args: string) -> result<option<string>, string>` | `/name args` typed by `player`: ok(some(text)) is their feedback, err(text) their error in red. |
|
||||
| `block-broken` | `func(player: player, pos: block-pos, state: string)` | A player broke the block at `pos` in their dimension: `state` is what was there, as `minecraft:oak_log[axis=y]`. |
|
||||
| `block-placed` | `func(player: player, pos: block-pos, state: string)` | A player placed `state` at `pos` in their dimension. |
|
||||
|
||||
+16
-11
@@ -13,14 +13,14 @@ the player before the mod is turned on, and checked against the component's real
|
||||
|
||||
| | Count |
|
||||
| --- | --- |
|
||||
| Interfaces the game offers | 5: `log`, `game`, `chat`, `hud`, `storage` |
|
||||
| Functions in them | 9 |
|
||||
| Hooks a mod exports | 5: `init`, `tick`, `frame`, `command`, `chat` |
|
||||
| Capabilities | 5: `game-read`, `chat`, `hud`, `storage`, `registries` |
|
||||
| Manifest `api` lines served | 2: `0.1` (code), `0.2` (content) |
|
||||
| SDK | the `Mod` trait (5 methods), `Registration` (4 builders), `export_mod!`, log helpers |
|
||||
| Interfaces the game offers | 6: `log`, `game`, `chat`, `hud`, `storage`; `players` for server mods |
|
||||
| Functions in them | 12 |
|
||||
| Hooks a mod exports | 5: `init`, `tick`, `frame`, `command`, `chat`; a server mod 8: `init`, `tick`, `player-joined`, `player-left`, `chat`, `command`, `block-broken`, `block-placed` |
|
||||
| Capabilities | 6: `game-read`, `chat`, `hud`, `storage`, `registries`, `players` |
|
||||
| Manifest `api` lines served | 3: `0.1` (code), `0.2` (content), `0.3` (server mods, experimental) |
|
||||
| SDK | the `Mod` trait (5 methods), `Registration` (4 builders), `export_mod!`, log helpers; `server::ServerMod` (8 methods), `server::Registration` (5 builders), `export_server_mod!` |
|
||||
| `cargo horizon-mod` | `new` (templates `code` and `content`), `build`, `run`, `test`, `check` |
|
||||
| Example mods | `coords-hud` (code), `ruby-content` (content) |
|
||||
| Example mods | `coords-hud` (code), `ruby-content` (content), `welcome` (server) |
|
||||
|
||||
## Guide
|
||||
|
||||
@@ -49,6 +49,8 @@ call, 4 MiB of storage, fuel per call).
|
||||
- `crates/horizon-mod-sdk/examples/coords-hud`: coordinates, facing and time on the HUD; `/where`, `/coords`; storage.
|
||||
- `crates/horizon-mod-sdk/examples/ruby-content`: no code; a gem and a block of ruby from vanilla templates, with
|
||||
their recipes, loot, tags, models, textures and names.
|
||||
- `crates/horizon-mod-sdk/examples/welcome`: a server mod; greets players who join, announces newcomers (kept in
|
||||
storage), `/online` and `/mined`.
|
||||
- `crates/horizon-mods/tests/guest`: a mod that misbehaves on command (spins, panics, grows its memory), for the
|
||||
sandbox tests.
|
||||
|
||||
@@ -78,15 +80,16 @@ scripting runtime in the game.
|
||||
## Stability
|
||||
|
||||
Preview ([stability.md](stability.md)): API 0.1 and content 0.2 are served together; a mod built for 0.1.0 keeps
|
||||
loading on every 0.1.x game. Server mods come as their own line, `api = "0.3"`, experimental first.
|
||||
loading on every 0.1.x game. Server mods are their own line, `api = "0.3"`, experimental: they may change in any
|
||||
release.
|
||||
|
||||
## Not there yet
|
||||
|
||||
What real mods need next, in the order modpacks and servers need it:
|
||||
|
||||
- **Server mods** (`api = "0.3"`): the same component running on the server thread and the dedicated server, with world events (block
|
||||
broken or placed, entity spawned or killed, player joined or left), game rules and server commands with typed
|
||||
arguments.
|
||||
- **Server mods in the game** (`api = "0.3"`, [Server mods](../mods.md#server-mods-api-03-experimental)): the
|
||||
contract, runtime and SDK are here; next the server thread, LAN host and dedicated server start them and call
|
||||
their hooks, then entity events, game rules and server commands with typed arguments.
|
||||
- **World and blocks**: read blocks, block states and biomes in loaded chunks; change them through the server's block
|
||||
log, so clients and the parity harnesses see vanilla's updates.
|
||||
- **Items and inventories**: the player's inventory, held item and open container; item stacks with components.
|
||||
@@ -102,6 +105,8 @@ What real mods need next, in the order modpacks and servers need it:
|
||||
|
||||
## Changelog
|
||||
|
||||
- API 0.3 (server mods, experimental): world `horizon-server-mod`, capability `players`, the `server-events`
|
||||
hooks; SDK `server::ServerMod`; example `welcome`.
|
||||
- SDK: `cargo horizon-mod test` and `horizon_mods::testing`, test scripts in TOML; the template has one.
|
||||
- Experimental: `ui` button widget; `render.set-corner`, `text-width`, `frame-stats`; `input.mapping`,
|
||||
`clicks-per-second` (what the official FPS, keystrokes and zoom mods need).
|
||||
|
||||
+17
-1
@@ -34,6 +34,22 @@ Not breaking: a new function, interface, capability, command, endpoint, tool or
|
||||
argument or JSON field (readers must ignore fields they don't know); a new WIT function or type (mods built earlier
|
||||
don't import it); faster, or fixing behaviour to what the reference already says.
|
||||
|
||||
### Mod API levels
|
||||
|
||||
A new WIT function doesn't break older mods, but a mod that calls it can't run on a Horizon from before it. So every
|
||||
function the game offers mods has an **API level**, the one it arrived at (`crates/horizon-mods/src/api_level.rs`):
|
||||
level 0 is the contract of Horizon 0.2.67 to 0.2.69, level 1 adds `render.set-minimap` and server mods' `players`. A mod needs the level of
|
||||
the newest function it imports (a component imports only the functions it calls). The level is read from the file,
|
||||
never declared:
|
||||
|
||||
- the game refuses a mod that needs a function it doesn't have, with "made for a newer Horizon (it uses
|
||||
render.set-minimap): update Horizon to run it", instead of a linking error;
|
||||
- the registry's CI writes each mod version's level into the index (`api_level`), and installers take the newest
|
||||
version the running game can run.
|
||||
|
||||
A pull request that adds a function lists it in `api_level.rs` at the next level and raises `LEVEL`; the
|
||||
`api_reference` test fails until it does.
|
||||
|
||||
## Stability levels
|
||||
|
||||
Every part of an API has one level, shown in its reference and its surface page.
|
||||
@@ -92,7 +108,7 @@ Deprecations and breaking changes are in bold. The release notes of the game rel
|
||||
| Mod API: `render` (HUD shapes, camera shake and zoom; drawn by the game, no mod shaders) | experimental | manifest `experimental = ["render"]` |
|
||||
| Mod API: `input` (claimed items' use, the mod's keys, the mouse wheel) | experimental | manifest `experimental = ["input"]` |
|
||||
| Content mods (`registries`: data-driven blocks and items) | preview | manifest `api = "0.2"` |
|
||||
| Server mods (events, world, server commands) | not started | manifest `api = "0.3"`, experimental first |
|
||||
| Server mods: world `horizon-server-mod`, `players`, `server-events` | experimental | manifest `api = "0.3"` |
|
||||
| Script mods (Lua run by an interpreter mod, [mods.md](mods.md#ways-in)) | not started | |
|
||||
| `cargo horizon-mod` (`new`, `build`, `run`), `horizon-mod-sdk` | preview | 0.1.0 |
|
||||
| Shader API | not started | |
|
||||
|
||||
@@ -51,7 +51,7 @@ file selects ~103.
|
||||
| 34 | Multiplayer and LAN screens, friends (44) | `L/multiplayer.rs`, `G/lan_screen.rs`, `G/friends.rs`, `L/friends_screen.rs`, `crates/horizon-friends/`, `crates/horizon-relay/` | lan, world_options; `python3 tools/test_friends.py` |
|
||||
| 35 | Dispensers (43) | `G/dispenser.rs`, `G/dispense_fixture.rs` (the harness side) | dispenser |
|
||||
| 36 | Audio and music (38) | `L/audio.rs`, `L/sound_engine.rs`, `L/sound_events.rs`, `L/music.rs`, `G/music.rs`, `L/ambience.rs`, `G/subtitle_hud.rs` | sound_engine, sound_event, music, situational_music, ambient_sound, subtitle |
|
||||
| 37 | Integrated server and levels (34) | `G/integrated.rs`, `G/levels.rs`, `G/server_travel.rs` | server_dimension_players, `lan_e2e --server-thread` (portals, levels, distance, lava) |
|
||||
| 37 | Integrated server and levels (34) | `G/integrated.rs`, `G/levels.rs`, `G/server_travel.rs` | server_dimension_players, `lan_e2e` (server-thread by default; portals, levels, distance, lava) |
|
||||
| 38 | Command parsing (34) | `L/command/` (`args.rs`, `selector.rs`, `tree_*.rs`, `vanilla.rs`) | command_parse (corpus `tools/command_parse_corpus.py`) |
|
||||
| 39 | Benchmarks and telemetry (34) | `L/benchmark.rs`, `tools/perf_bench.py`, `L/telemetry.rs`, `crates/horizon-telemetry*/`, `crates/horizon-bench/` | `python3 -m unittest tests.test_perf_bench`; [benchmark.md](benchmark.md) |
|
||||
| 40 | Explosions and TNT (31) | `G/explosion.rs`, `G/tnt.rs` | lan_e2e blast; no dedicated harness yet |
|
||||
|
||||
@@ -321,7 +321,7 @@ Search for packs Horizon loads.
|
||||
horizon-launcher mods search [TEXT]...
|
||||
|
||||
- `TEXT`
|
||||
- `--kind` (mod, resource, modpack)
|
||||
- `--kind` (mod, resource, modpack, shader)
|
||||
- `--everything`: Also what was made for other versions or runs only partly, each marked
|
||||
- `--source` (modrinth, curseforge, horizon)
|
||||
|
||||
|
||||
+10
-6
@@ -1,7 +1,7 @@
|
||||
# The launcher's mod browser
|
||||
|
||||
Search Modrinth (CurseForge support is coming soon) for Java mods, modpacks, resource packs and shader
|
||||
packs, see how well each one runs before installing it, and install it with its checksum checked. This is item 16 of the roadmap and issue #577. The code is in
|
||||
Search Modrinth (CurseForge support is coming soon) for Java mods, modpacks and resource packs, and Horizon's
|
||||
registry for Horizon's own mods, modpacks, resource packs and shader packs; see how well each one runs before installing it, and install it with its checksum checked. This is item 16 of the roadmap and issue #577. The code is in
|
||||
`launcher/src/browser.rs` and `launcher/src/browser/`.
|
||||
|
||||
## What it offers
|
||||
@@ -16,6 +16,7 @@ yet (Modrinth has no `horizon` loader).
|
||||
| Java mods (Fabric, NeoForge, Forge, Quilt) | ported into `horizon-mods/<mod id>/` and turned on | Checked from its jar before install: **Works**, **Partly** or **Doesn't run** ([below](#java-mods)) |
|
||||
| Resource packs | `resourcepacks/` beside `options.txt` | **Works** when made for 26.3 ([resource-packs.md](resource-packs.md) lists what Horizon reads). Older packs are **Partly**: they load with vanilla's compatibility warning |
|
||||
| Modpacks (`.mrpack`, CurseForge zip) | the Modpacks page's import | **Partly**: Horizon runs the mods it can port, from the player's own downloads ([modpacks.md](modpacks.md)) |
|
||||
| Shader packs (`.hshader`, Horizon's registry only) | `shaderpacks/` beside `options.txt` | **Works** when made for 26.3: checked by the game's own check before install ([shaders.md](shaders.md)). The `shaders/`-format packs on Modrinth and CurseForge are not offered |
|
||||
|
||||
By default a search shows only what runs: Java mods made for 26.3, resource packs made for 26.3, and every modpack. **Show everything** lists the rest of the kind too, each marked with how well it runs; what doesn't run is
|
||||
never offered for install.
|
||||
@@ -74,7 +75,8 @@ start); the hedge places and its recipe crafts 4.
|
||||
|
||||
## The Mods page
|
||||
|
||||
The launcher's **Mods** page has the three kinds as tabs (Mods, Modpacks, Resource packs), a search field (Enter searches), **Show everything** and
|
||||
The launcher's **Mods** page has the four kinds as tabs (Mods, Modpacks, Resource packs, Shader packs; the last
|
||||
searches Horizon's registry), a search field (Enter searches), **Show everything** and
|
||||
the source: Modrinth, with **CurseForge (coming soon)** beside it, disabled. Each result is an index row: its summary, author,
|
||||
downloads, source and licence, how well it runs (and why), **Page** (the project's page on its source) and
|
||||
**Install** (**Import** for a modpack). The Modpacks tab lists the imported packs first, with their coverage
|
||||
@@ -125,7 +127,8 @@ same name the player put there is never overwritten.
|
||||
|
||||
- **Install** picks the newest version that runs, then its required dependencies, checked before any download: a
|
||||
dependency that isn't a pack Horizon loads (a Java mod) stops the install. Dependencies go in first. A resource
|
||||
pack still has to be turned on in the game's Resource Packs screen, as in vanilla.
|
||||
pack still has to be turned on in the game's Resource Packs screen, as in vanilla, and a shader pack picked in
|
||||
the game's Shader Packs page.
|
||||
- **Update** installs the newer version and removes the old file.
|
||||
- **Remove** deletes the file and its entry. Packs installed as dependencies stay.
|
||||
- **A modpack** is downloaded (checked the same way) into `ports/downloads/`, imported, and ported straight away
|
||||
@@ -149,7 +152,7 @@ horizon-launcher mods remove faithful-32x
|
||||
|
||||
## Sources
|
||||
|
||||
**Horizon's registry.** Mods (`.hmod`) and resource packs made for Horizon, reviewed as pull requests in
|
||||
**Horizon's registry.** Mods (`.hmod`), modpacks (`.hpack`), resource packs and shader packs (`.hshader`) made for Horizon, reviewed as pull requests in
|
||||
[ludovic111/horizon-mods](https://github.com/ludovic111/horizon-mods) ([api/mod-index.md](api/mod-index.md)). The
|
||||
launcher reads its `index.json` (`browser/horizon.rs`; `HORIZON_MOD_INDEX=<file or https address>` reads a test
|
||||
registry instead, whose files may then be on disk) at most every ten minutes, and keeps the last copy in
|
||||
@@ -164,7 +167,8 @@ checked pack, `pack.json` and `home/`, the profile's game folder, where each of
|
||||
like any registry mod and turned on or off as the pack says; its overrides (settings, resource packs, a mod's saved
|
||||
settings) are copied in on the first install only, so the player's changes survive updates. A pack whose mod was taken
|
||||
down installs nothing. It is listed on the Modpacks tab with **Play** and **Remove**, and plays like an imported pack
|
||||
(`modpacks::apply_profile`). Shader packs are listed by the index but not installed by this launcher yet.
|
||||
(`modpacks::apply_profile`). A shader pack goes to `shaderpacks/<file>` once `check_file` has run the game's own
|
||||
check on it (`horizon_shader_api::check`); a taken-down one is named, for the player to remove.
|
||||
|
||||
```sh
|
||||
horizon-launcher mods search --source horizon --kind mod coords # with whether it is signed and what it may do
|
||||
|
||||
+16
-15
@@ -504,21 +504,22 @@ Two cases the oracle fills in:
|
||||
mod. Better Dungeons' small dungeons keep one chest and each other one with a fifth's
|
||||
chance, two at most (the game's `horizon:count_cap`, counted per placement as the mod's
|
||||
DungeonContext is): 12 chests in five small dungeons at seed 1234 become 6.
|
||||
Lithostitched's `block_swap` (137 lists, all in ChoiceTheorem's Overhauled Village) is the
|
||||
game's `horizon:block_swap`: the same map, with Block.withPropertiesOf's properties kept;
|
||||
a target block the game does not have (most of them are Nature's Spirit's and Croptopia's)
|
||||
leaves the block as it is, as the mod does. Lithostitched's `reference` (CTOV builds most
|
||||
of its lists from others) has the referenced lists' processors written in its place; its
|
||||
`apply_random`, `condition` and `set_block` are the game's `horizon:apply_random`,
|
||||
`horizon:condition` and `horizon:set_block`, with Lithostitched's random (the world seed
|
||||
plus the name's hash, at the block, piece or structure). In a CTOV plains village at seed
|
||||
1234 the farms now grow carrots, potatoes and beetroot besides wheat, and 1,655
|
||||
cobblestone blocks become paths, grass, mossy cobblestone and planks. No Lithostitched processor is
|
||||
dropped now (130 before). CTOV's compat hooks for other mods inside them (its
|
||||
`modular_compat`, 142 copies) run a list of their own only when the mod they name is
|
||||
loaded: carry writes that list in when the mod is ported along and takes the hook out (a
|
||||
no-op, as in the mod) when it is not. In ATM10 all 142 name Nature's Spirit, which the
|
||||
pack does not have.
|
||||
Lithostitched's processors (all in ChoiceTheorem's Overhauled Village in ATM10) are the
|
||||
game's own types, read as the mod writes them. `block_swap` keeps the properties the new
|
||||
block can have: a farm's ripe wheat becomes ripe carrots, but beetroot, whose age stops at
|
||||
3, keeps its default; a target block the game does not have (most are Nature's Spirit's and
|
||||
Croptopia's) leaves the block as it is. `reference` runs the lists it names, `condition`
|
||||
tests the template's block or the world's, `apply_random` and `set_block` draw per block or
|
||||
per piece as the data says. Lithostitched's own random is not known yet, so the shares of a
|
||||
random choice are the Java pack's but the blocks chosen differ. Lists named by tag and state
|
||||
providers other than simple and weighted ones are dropped and counted (ATM10 has none).
|
||||
CTOV's compat hooks for other mods (its `modular_compat`, 30 of them in 17 lists) become a
|
||||
`reference` when the mod they name is ported along, and are taken out (a no-op, as in the
|
||||
mod) when it is not. In ATM10 they all name Nature's Spirit, which the pack does not have.
|
||||
In Java, Lithostitched also lays out every jigsaw structure its own way (villages,
|
||||
outposts, trial chambers; CTOV's villages are `lithostitched:jigsaw`, carried as vanilla's
|
||||
jigsaw). Horizon keeps vanilla's layouts, so with Lithostitched in a pack, structure layouts
|
||||
differ from the Java pack's for the same seed (their positions do not).
|
||||
The processors that build outside their template are carried too: Repurposed's and
|
||||
Moog's pillar processors become the game's `horizon:pillar` (a column from a placeholder
|
||||
block down to the ground, with the processor list they run on each of its blocks written
|
||||
|
||||
+52
-2
@@ -120,7 +120,7 @@ loading. Ordered by what the first native ports need:
|
||||
| `world-read` | blocks and biomes around the player, within the render distance | minimaps, schematics |
|
||||
| `render` (world) | world-space lines, boxes and billboards, beside the HUD shapes `render` has | Litematica-style placement, waypoints |
|
||||
| `registries` | new blocks, items, entities and recipes, mostly data: JSON models, textures, loot and recipes in the `.hmod`'s `assets/` and `data/` | server side; see [Multiplayer](#multiplayer) |
|
||||
| `server` | world events (block break/place, entity spawn/death, player join), game rules, server commands | runs where the world is simulated |
|
||||
| `server` | world events (entity spawn/death), game rules, world read/write, typed server commands | after [server mods 0.3](#server-mods-api-03-experimental)'s players, chat, blocks and commands |
|
||||
| `net` | a mod's own client↔server channel (custom payloads) | only between the two halves of the same mod |
|
||||
|
||||
There is no file, socket, process or raw-input interface, on purpose.
|
||||
@@ -251,7 +251,8 @@ key> --signature <file>.minisig`.
|
||||
`cargo horizon-mod test` builds the mod, then runs each `tests/<name>.toml` in
|
||||
the sandbox the game uses, with no game and no window: the test plays the
|
||||
game's part (the player and the clock the mod reads, ticks, frames, chat lines,
|
||||
commands) and checks what the mod showed. A script fails at its first wrong
|
||||
commands; for a server mod, players joining, chatting, typing commands,
|
||||
breaking and placing blocks and leaving) and checks what the mod showed. A script fails at its first wrong
|
||||
step, with what it expected and what it got; the command fails if any script
|
||||
does. `--debug` builds without optimizing, `--hmod <file>` tests a `.hmod`
|
||||
already built, and a name runs only the scripts whose path holds it. Each
|
||||
@@ -288,6 +289,16 @@ A step's parts happen in this order:
|
||||
| `ticks = n`, `frames = n` | that many ticks (the game's tick counter and the clock move on), then frames 1/60 s apart |
|
||||
| `chat = "<Steve> hi"` | a chat line the player receives |
|
||||
| `command = "where north"` | the player types `/where north`; a command the mod doesn't own fails the step |
|
||||
| `break = { x = 1, y = 63, z = 0, state = "minecraft:stone" }`, `place = { ... }` | server mods: the player breaks or places that block |
|
||||
| `leave = "Alex"` | server mods: that player leaves |
|
||||
|
||||
A server mod starts with nobody on: `join = "Alex"` (after `reload` and `title-screen`) brings a
|
||||
player in at the defaults, in survival, with the id
|
||||
`00000000-0000-4000-8000-000000000001` for the first name that joined, `...2`
|
||||
for the second, the same id when a name joins again. `player`, `chat`,
|
||||
`command`, `break` and `place` are then that player's doing: the one named by
|
||||
`as = "Steve"`, or the first one on. `player` takes `game-mode` there, and the
|
||||
script's own `[player]` and `[clock]` are a client mod's.
|
||||
|
||||
Then `expect` checks what the mod did during the step; a key left out is not
|
||||
checked:
|
||||
@@ -298,6 +309,7 @@ checked:
|
||||
| `chat = ["..."]` | every chat line it showed, in order (`[]`: none) |
|
||||
| `feedback = "..."`, `error = "..."` | the command's answer, shown plain or in red |
|
||||
| `panel = ["..."]`, `corner = "top-left"` | its HUD panel's lines (`[]`: no panel) and corner |
|
||||
| `told = ["Alex: Welcome!"]`, `broadcast = ["..."]` | server mods: every `players.tell` (as `name: text`) and `players.broadcast`, in order |
|
||||
| `stopped = "panic"` | the mod was turned off, for a reason holding this text; without it, a mod that traps, panics or overruns fails the test |
|
||||
|
||||
Unknown keys are errors, so a typo never passes silently. The same runner is
|
||||
@@ -452,6 +464,38 @@ none.
|
||||
"top": "carve", "bottom": "none", "rigid_junctions": true, "inflate": true } }
|
||||
```
|
||||
|
||||
### Server mods (API 0.3, experimental)
|
||||
|
||||
A server mod runs where the world is simulated: on the dedicated server, on a
|
||||
LAN host and on single player's own server, never in a player's window. Its
|
||||
manifest says `side = "server"` and `api = "0.3"` (and only a server mod may);
|
||||
its component targets the WIT world `horizon-server-mod` instead of
|
||||
`horizon-mod`. Experimental: it may change in any release
|
||||
([stability](api/stability.md)).
|
||||
|
||||
| Interface | Capability | Functions |
|
||||
|---|---|---|
|
||||
| `log` | always | as for client mods |
|
||||
| `storage` | `storage` | as for client mods, in the server's `horizon-mods/` |
|
||||
| `players` | `players` | `online()`: id, name, position, dimension, game mode, health of each player on; `tell(id, text)`, `broadcast(text)`: system messages after the mod's name, 8 per call |
|
||||
|
||||
| Hook (export `server-events`) | When |
|
||||
|---|---|
|
||||
| `init() -> result<registration, string>` | once, after loading |
|
||||
| `tick(tick)` | each server tick |
|
||||
| `player-joined(player)`, `player-left(player)` | `registration.joins` |
|
||||
| `chat(player, text)` | `registration.chat`: each chat message a player sends |
|
||||
| `command(player, name, args)` | `/name args` typed by a player, for a command it registered; `ok(some)` is that player's feedback, `err` their red error |
|
||||
| `block-broken(player, pos, state)`, `block-placed(player, pos, state)` | `registration.blocks`, with the state as `minecraft:oak_log[axis=y]` |
|
||||
|
||||
Capabilities that act on a local player (`game-read`, `chat`, `hud`) are for
|
||||
client mods; `players` is for server mods. In Rust: `impl
|
||||
horizon_mod_sdk::server::ServerMod` and `export_server_mod!`; the example is
|
||||
[`welcome`](../crates/horizon-mod-sdk/examples/welcome/src/lib.rs). The
|
||||
runtime, the registry's `check` and the SDK run them today; the game starts
|
||||
them once its server code calls these hooks (the next step), and until then a
|
||||
server mod that is turned on shows as run elsewhere.
|
||||
|
||||
## Publish your mod
|
||||
|
||||
Horizon's registry lists mods, modpacks (`.hpack`) and resource packs made for Horizon, each reviewed before it is
|
||||
@@ -501,6 +545,12 @@ so the same rustc and `Cargo.lock` give the same file.
|
||||
release cycle, so existing mods keep working while authors move.
|
||||
- The manifest's `api` names the line it needs (`0.1`); the game refuses a
|
||||
line it does not serve with a clear message.
|
||||
- Within a line, each function has an API level, the one it arrived at
|
||||
([stability](api/stability.md#mod-api-levels)). A mod needs the level of
|
||||
the newest function it calls, read from its file: an older Horizon refuses
|
||||
it with "made for a newer Horizon: update Horizon", and the registry lists
|
||||
the level so installers take a version the game can run.
|
||||
`cargo horizon-mod check` prints it ("needs mod API level 1 or newer").
|
||||
- Horizon follows Minecraft releases; the mod API does not have to. Vanilla
|
||||
concepts mods see (dimensions, block and item ids) are the game's own ids,
|
||||
so a version port changes the data, not the API.
|
||||
|
||||
@@ -111,3 +111,53 @@ and shrieker. They supplement the deterministic component comparisons.
|
||||
## Reading vanilla
|
||||
|
||||
Besides the Vineflower sources in `.local/minecraft/<version>/sources/`, `tools/rea_vanilla.py` queries the shipped bytecode through REA (callers through lambdas, overloads, a second decompiler); see [decompilation status](decompilation-status.md#querying-the-shipped-bytecode-with-rea).
|
||||
|
||||
## Player-facing integration and deterministic fixtures
|
||||
|
||||
`python3 tools/lan_e2e.py` runs every LAN check with an integrated server thread,
|
||||
the same path as normal single player. `python3 tools/test_friends.py --client
|
||||
target/fast/horizon-client --relay target/fast/horizon-relay --baseline` covers
|
||||
plain LAN, direct invitations, a local relay and ended invitations in that mode.
|
||||
Both accept `--in-frame` for comparison and retain `--server-thread` for existing
|
||||
callers. Run Linux games under `xvfb-run -a` when no display is available. Each
|
||||
process gets scratch game, launcher, XDG data and config homes; telemetry, audio
|
||||
and launcher self-update are disabled.
|
||||
|
||||
`lan_integration` and `friends_integration` register these suites with `parity.py`.
|
||||
`friends_integration` (under a minute) is selected like any harness when the
|
||||
drivers or game implementation change. `lan_integration` is the whole LAN suite
|
||||
(~40 minutes on a loaded runner, and single checks flake under load), so
|
||||
`tools/parity_hosts.json` lists it under `named_only`: no automatic selection
|
||||
(`--changed`, `--failed`, `--flake-check`, CI, parity-main) picks it; it runs
|
||||
when named and in the nightly audit (`--all`). LAN writes `results.json`
|
||||
with the host mode and each result beside its screenshots and logs. A skipped
|
||||
case is recorded explicitly and does not count as passing coverage.
|
||||
|
||||
The game-binary fixture audit keeps these complementary direct rule tests:
|
||||
|
||||
- `command_harness.rs`: command feedback, styled spans and result callbacks,
|
||||
held player position, explicit ticks and portal completion matching
|
||||
`VanillaCommandExecOracle`. LAN `commands`, `feedback`, `styles`, `levels` and
|
||||
`portals` cover command input, packet feedback and travel across the boundary.
|
||||
- `dispense_fixture.rs`: seeded synthetic worlds, block/event traces, item
|
||||
use/mining and combat hooks matching `VanillaDispenserOracle`. These isolate
|
||||
rule results and RNG order; LAN machines, crafting, clicks, fireball, mining
|
||||
and combat exercise real input and server handling separately. The new
|
||||
`dispenser_input_host` / `dispenser_input_guest` checks press a button and
|
||||
verify authoritative inventory consumption and exactly one drop on both clients.
|
||||
- `sculk_fixture.rs`: scripted events and exact per-tick sculk/warden traces
|
||||
matching `VanillaSculkOracle`; introducing wall-clock network ticks would
|
||||
destroy that deterministic oracle contract. `sculk_input_host` and
|
||||
`sculk_input_guest` separately exercise real footsteps reaching a sensor;
|
||||
failures remain visible rather than changing the oracle trace.
|
||||
- `net_harness.rs`: already a real network client of a dedicated server; keep
|
||||
its handshake, world loading, chat and command packet assertions.
|
||||
|
||||
Library probes, `lan_bot`'s protocol hub fixture, generation/save tests and
|
||||
streaming/mesh tests remain fast deterministic coverage. They do not become
|
||||
full game launches. Setup and authoritative reads use the owning server;
|
||||
interactions stay on the client. `server-hold on|off` provides a prediction-test
|
||||
barrier between server ticks, including player packet handling, while transport
|
||||
threads and control calls remain responsive. `stall MILLISECONDS` stalls only
|
||||
the window to test recovery from a hung frame without process signals interrupting
|
||||
socket reads. Neither mechanism changes normal gameplay.
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ Horizon's own format.
|
||||
| Templates | `crates/horizon-shader-api/templates/` | post, sky, material |
|
||||
| Example pack | `crates/horizon-shader-api/packs/golden_hour` | a warm sky and two post passes |
|
||||
| In the game: every stage | Options > Horizon Settings > Shader Packs | sky, material, post passes, hot reload |
|
||||
| The launcher and the registry | | not yet |
|
||||
| The registry and the launcher | `shader` kind ([api/mod-index.md](api/mod-index.md)); the Mods page's Shader packs tab | checked, then installed into `shaderpacks/` |
|
||||
|
||||
## Quick start
|
||||
|
||||
@@ -137,4 +137,4 @@ without the pack.
|
||||
|
||||
## Next
|
||||
|
||||
The registry's `shader` kind with installs from the launcher, then the overlay, lighting and shadow stages.
|
||||
The overlay, lighting and shadow stages, and option values other than the defaults.
|
||||
|
||||
Reference in New Issue
Block a user