Files
horizon-airdef/crates/horizon-mods/src/lib.rs
T
Ludovic Marie 746c888cd3 horizon-mods: content mods (API 0.2), blocks and items declared from vanilla templates
A .hmod may carry assets/ and data/ beside mod.wasm, or instead of it. The
manifest needs api = "0.2" and the new registries capability ("add blocks
and items to your worlds"). Content mods have no WIT interface: code still
links API 0.1.

horizon_mods::content::Content reads a mod's content and checks it:
- plain resource paths only;
- 65,536 files, 16 MiB each, 512 MiB in all;
- files in the mod's own namespace, plus additions to vanilla tags;
- blocks and items declared in data/<id>/horizon/{block,item}/*.json, each
  copying a vanilla template with typed overrides (hardness, resistance,
  light, tool, friction, map colour, sounds; stack size, rarity), unknown
  keys refused.

Mods::load refuses an enabled mod whose content fails these checks, with
the reason on its row. A content-only mod is on with no engine and no hooks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 19:23:35 +02:00

17 lines
641 B
Rust

//! Horizon's mods (`docs/mods.md`): WebAssembly components written against
//! `crates/horizon-mod-sdk/wit/horizon.wit`, each in its own sandbox with
//! no file, network or clock access, a memory cap and a time budget per
//! call. A mod that traps or overruns is turned off; the game goes on.
//!
//! Nothing here runs unless a mod is installed and turned on: an empty
//! [`Mods`] makes no engine and every hook returns at once.
pub mod content;
pub mod manifest;
#[cfg(feature = "runtime")]
mod runtime;
pub use content::Content;
pub use manifest::{Capability, Manifest, Package, Side};
#[cfg(feature = "runtime")]
pub use runtime::*;