For agents
Rules for a coding agent making a Horizon mod. They are short on purpose; each links to its page.
- Choose the shape. A content mod has no
Cargo.toml. A code mod hasCargo.tomlandsrc/at the top and implementsHookswith#[mod_api::horizon_mod]. Never write raw injections first. - Use a hook or a Part method when one exists (search the rustdoc of
horizon-mod-api). A per-block, per-item or per-entity moment is a Part method (Parts). - Otherwise follow the injection ladder: an API
[[inject]]declaration naming a crate-root function and itsmod_pointsrecord; useaccess = "internals"and declared internals only when the API cannot express it. Every injection comes with a hook request. API injections never rebuild the game: missing slots are refused, and source rebuilds and call-site injections require internals access or a hook request. - Names: NeoForge 26.3 names for hooks that have a counterpart; no
on_prefix; the event is&mut; handles come from the event; writes takehost. - Layout:
horizon-mod.toml,assets/,data/,Cargo.tomlandsrc/at the top. The id and version come only fromhorizon-mod.toml; ids are[a-z0-9_]. Nonative/folder, nohorizon-native.json. - Manifest fields:
id,name,version,description,authors,api = "0.2",side,capabilities = ["registries"],[dependencies], top-levelinternalsand[[inject]],[native](game,horizon,mixins, optionalmodule) or[wasm],[[jar]]. One of[native]or[wasm], never both. Unknown fields are refused (manifest). - Freshness errors: a changed function hash or call context refuses the injection; use
inject updateor reselect it withinject add. Never substitute a different call. - Data and assets are read through a reload hook, once per reload, never on the tick.
- Missing hook? File a hook request on arismoko/horizon.