c9f554d1c4
A server mod runs where the world is simulated. Its manifest says side = "server" and api = "0.3" (only a server mod may), and its component targets the new WIT world horizon-server-mod: - imports log and storage as client mods do, and the new capability players: online() (id, name, position, dimension, game mode, health), tell(id, text), broadcast(text), 8 lines per call shared with chat; - exports server-events: init, tick, player-joined, player-left, chat, command (with the player who typed it; its feedback goes back to that player), block-broken and block-placed (with the block state as text). horizon-mods: a second bindgen world sharing log and storage with the first; a running mod holds either kind of hooks; Mods::load_for(Runs) starts only the mods a game runs (the window client mods, the world's server server mods, in-frame single player both) and marks the others Elsewhere. Client and server commands are owned separately. The game passes Runs::Client for now, so nothing changes in game until its server code calls these hooks. The SDK gains horizon_mod_sdk::server (ServerMod, Registration, export_server_mod!), the example server mod welcome (greets, announces newcomers kept in storage, /online, /mined), and cargo horizon-mod check's trial run plays a server mod with a player joining, chatting, typing its commands and leaving. The manifest refuses client capabilities on a server mod and players on a client mod. The generated reference, the guide, the portal and the stability table describe it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 lines
321 B
TOML
17 lines
321 B
TOML
[package]
|
|
name = "welcome"
|
|
version = "0.1.0"
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
publish = false
|
|
description = "Example Horizon server mod: greets players, announces newcomers, /online and /mined"
|
|
|
|
[lib]
|
|
crate-type = ["cdylib"]
|
|
|
|
[dependencies]
|
|
horizon-mod-sdk = { path = "../.." }
|
|
|
|
[lints]
|
|
workspace = true
|