From ba4cf45aacb5564ae04bce109e466c48dea9f2eb Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Sun, 25 Oct 2026 16:35:01 +0100 Subject: [PATCH] cargo horizon-mod: content mods (new --template content, build packs assets and data, check takes no code) - `new --template content`: a content mod with one block (Glowing Amethyst, copying vanilla's amethyst block) and its block state, model, item model, name, loot, recipe and pickaxe tag; `--template code` is the default. - `build` packs the mod's `assets/` and `data/` (read and checked as the game reads them) beside the component; a folder without `Cargo.toml` is a content mod and needs no compiler. - `check` takes a `.hmod` with no `mod.wasm`: "no code: content only, nothing to run" instead of the trial run, which refused it, so the registry can publish content mods. - The guide (content mods, make a mod) and docs/mods.md, docs/api/mods.md say so. Co-Authored-By: Claude Opus 5.5 --- crates/cargo-horizon-mod/src/check.rs | 16 +- crates/cargo-horizon-mod/src/main.rs | 168 +++++++++++++++--- .../template/content/block.json | 4 + .../template/content/blockstate.json | 5 + .../template/content/horizon-mod.toml | 10 ++ .../template/content/item.json | 3 + .../template/content/lang.json | 3 + .../template/content/loot.json | 11 ++ .../template/content/model.json | 4 + .../template/content/pickaxe.json | 3 + .../template/content/recipe.json | 6 + docs/api/mods.md | 3 +- docs/mods.md | 8 +- website/docs/content-mods.md | 20 ++- website/docs/make-a-mod.md | 2 +- 15 files changed, 233 insertions(+), 33 deletions(-) create mode 100644 crates/cargo-horizon-mod/template/content/block.json create mode 100644 crates/cargo-horizon-mod/template/content/blockstate.json create mode 100644 crates/cargo-horizon-mod/template/content/horizon-mod.toml create mode 100644 crates/cargo-horizon-mod/template/content/item.json create mode 100644 crates/cargo-horizon-mod/template/content/lang.json create mode 100644 crates/cargo-horizon-mod/template/content/loot.json create mode 100644 crates/cargo-horizon-mod/template/content/model.json create mode 100644 crates/cargo-horizon-mod/template/content/pickaxe.json create mode 100644 crates/cargo-horizon-mod/template/content/recipe.json diff --git a/crates/cargo-horizon-mod/src/check.rs b/crates/cargo-horizon-mod/src/check.rs index 0294bec98..8a25d1a24 100644 --- a/crates/cargo-horizon-mod/src/check.rs +++ b/crates/cargo-horizon-mod/src/check.rs @@ -21,6 +21,8 @@ pub struct Report { pub sha256: String, pub size: u64, pub signed: bool, + /// A mod has code to run (a content mod may have none). + pub code: bool, /// A mod's component imports. pub imports: Vec, /// A mod's commands, each run once. @@ -49,6 +51,7 @@ impl Report { "sha256": self.sha256, "size": self.size, "signed": self.signed, + "code": self.code, "imports": self.imports, "commands": self.commands, "output": self.output, @@ -87,7 +90,9 @@ impl Report { for r in &f.requires { out += &format!(" needs {} {} ({})\n", r.id, r.version, &r.sha256[..12]); } - if self.kind == Kind::Mod { + if self.kind == Kind::Mod && !self.code { + out += " no code: content only, nothing to run\n"; + } else if self.kind == Kind::Mod { let commands = if self.commands.is_empty() { String::new() } else { @@ -142,6 +147,7 @@ pub fn check( sha256: index::sha256_file(path)?, size, signed, + code: false, imports: Vec::new(), commands: Vec::new(), output: Vec::new(), @@ -153,10 +159,14 @@ pub fn check( } /// Runs a mod in the sandbox, as the game does, from a scratch copy so its -/// storage lands in a folder removed afterwards. +/// storage lands in a folder removed afterwards. A content mod has no code to +/// run: `inspect` already read its content as the game does. fn trial_run(path: &Path, report: &mut Report) -> Result<(), String> { let package = Package::read(path)?; - let wasm = package.wasm.as_deref().ok_or("the .hmod has no mod.wasm")?; + let Some(wasm) = package.wasm.as_deref() else { + return Ok(()); + }; + report.code = true; report.imports = component_imports(wasm)?; package .manifest diff --git a/crates/cargo-horizon-mod/src/main.rs b/crates/cargo-horizon-mod/src/main.rs index 925633930..a4585f680 100644 --- a/crates/cargo-horizon-mod/src/main.rs +++ b/crates/cargo-horizon-mod/src/main.rs @@ -1,14 +1,16 @@ //! `cargo horizon-mod`: make Horizon mods in Rust (`docs/mods.md`). //! -//! - `new [--name "Name"] [--sdk-path ]`: a mod crate from the template. -//! - `build [--debug]`: the `.hmod` in `target/horizon-mod/`. +//! - `new [--template code|content] [--name "Name"] [--sdk-path ]`: +//! a mod from a template: a Rust crate, or a content mod (no code). +//! - `build [--debug]`: the `.hmod` in `target/horizon-mod/`, with the mod's +//! `assets/` and `data/`; a folder without `Cargo.toml` is content only. //! - `run [--game ] [-- ]`: build, then play with //! the mod; run `build` again and the game reloads it. //! - `check [--json]`: what the registry checks of a submission //! (`.hmod`, `.hpack`, resource pack `.zip`), with a trial run for a mod. //! - `registry build|review|check|list`: the registry repository's CI. use horizon_mods::{ - Manifest, Package, + Capability, Content, Manifest, Package, manifest::{MANIFEST, component_imports, componentize}, }; mod check; @@ -36,7 +38,7 @@ fn main() -> ExitCode { Some("run") => run(&args[1..]), Some("check") => check(&args[1..]), Some("registry") => registry::main(&args[1..]), - _ => Err("usage: cargo horizon-mod new | build [--debug] | run [--game ] [-- ] | check [--kind ] [--key --signature ] [--json] | registry build|review|check|list".into()), + _ => Err("usage: cargo horizon-mod new [--template code|content] | build [--debug] | run [--game ] [-- ] | check [--kind ] [--key --signature ] [--json] | registry build|review|check|list".into()), }; match result { Ok(()) => ExitCode::SUCCESS, @@ -90,19 +92,68 @@ fn new(args: &[String]) -> Result<(), String> { .replace("{name}", &name) .replace("{sdk}", &sdk) }; - let files = [ + let code = [ ("Cargo.toml", include_str!("../template/Cargo.toml.in")), (MANIFEST, include_str!("../template/horizon-mod.toml")), ("src/lib.rs", include_str!("../template/src/lib.rs")), (".gitignore", include_str!("../template/gitignore")), ]; - for (file, text) in files { + // A block copying a vanilla one, with its model, name, loot, recipe and tag. + let content = [ + ( + MANIFEST, + include_str!("../template/content/horizon-mod.toml"), + ), + ( + "data/{id}/horizon/block/glowing_amethyst.json", + include_str!("../template/content/block.json"), + ), + ( + "assets/{id}/blockstates/glowing_amethyst.json", + include_str!("../template/content/blockstate.json"), + ), + ( + "assets/{id}/models/block/glowing_amethyst.json", + include_str!("../template/content/model.json"), + ), + ( + "assets/{id}/items/glowing_amethyst.json", + include_str!("../template/content/item.json"), + ), + ( + "assets/{id}/lang/en_us.json", + include_str!("../template/content/lang.json"), + ), + ( + "data/{id}/loot_table/blocks/glowing_amethyst.json", + include_str!("../template/content/loot.json"), + ), + ( + "data/{id}/recipe/glowing_amethyst.json", + include_str!("../template/content/recipe.json"), + ), + ( + "data/minecraft/tags/block/mineable/pickaxe.json", + include_str!("../template/content/pickaxe.json"), + ), + (".gitignore", include_str!("../template/gitignore")), + ]; + let files: &[(&str, &str)] = match flag(args, "--template").unwrap_or("code") { + "code" => &code, + "content" => &content, + other => return Err(format!("no template {other}: code or content")), + }; + for &(file, text) in files { + let file = fill(file); + let file = file.as_str(); let to = dir.join(file); std::fs::create_dir_all(to.parent().expect("a file in the mod")) .map_err(|e| e.to_string())?; std::fs::write(&to, fill(text)).map_err(|e| format!("{}: {e}", to.display()))?; } - Manifest::parse(&std::fs::read_to_string(dir.join(MANIFEST)).map_err(|e| e.to_string())?)?; + let manifest = + Manifest::parse(&std::fs::read_to_string(dir.join(MANIFEST)).map_err(|e| e.to_string())?)?; + Content::read(dir, &manifest)?; println!( "Created {} (mod id {id}). Next: cd {path} && cargo horizon-mod run", dir.display() @@ -110,14 +161,53 @@ fn new(args: &[String]) -> Result<(), String> { Ok(()) } -/// Builds the crate in the current folder and packs `target/horizon-mod/.hmod`. +/// Builds the mod in the current folder and packs `target/horizon-mod/.hmod`: +/// the manifest, the crate's component (none without a `Cargo.toml`: a +/// content mod) and the files in `assets/` and `data/`. fn build(release: bool) -> Result { - let manifest_text = std::fs::read_to_string(MANIFEST) + build_in(Path::new("."), release) +} + +fn build_in(root: &Path, release: bool) -> Result { + let manifest_text = std::fs::read_to_string(root.join(MANIFEST)) .map_err(|e| format!("{MANIFEST}: {e} (run this in a mod's folder)"))?; let manifest = Manifest::parse(&manifest_text)?; + let (wasm, target_dir) = if root.join("Cargo.toml").exists() { + let (wasm, target) = compile(root, release)?; + // The game refuses a component importing capabilities the manifest lacks. + manifest.check_imports(component_imports(&wasm)?.iter().map(String::as_str))?; + (Some(wasm), target) + } else if manifest.capabilities.contains(&Capability::Registries) { + (None, root.join("target")) + } else { + return Err(format!( + "no Cargo.toml: only a content mod (capability registries in {MANIFEST}) has no code" + )); + }; + // The same checks as the game's, and the files in the order it lists them. + let content = Content::read(root, &manifest)?; + let mut reader = content.reader()?; + let mut files = Vec::with_capacity(content.files.len()); + for name in &content.files { + files.push((name.as_str(), reader.read(name)?)); + } + let files: Vec<(&str, &[u8])> = files.iter().map(|(n, b)| (*n, b.as_slice())).collect(); + let dir = target_dir.join("horizon-mod"); + std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?; + let path = dir.join(format!("{}.hmod", manifest.id)); + // Write then rename, so a running game never reads half a file. + let partial = path.with_extension("hmod.partial"); + let bytes = Package::write_files(&manifest_text, wasm.as_deref(), &files)?; + std::fs::write(&partial, bytes).map_err(|e| e.to_string())?; + std::fs::rename(&partial, &path).map_err(|e| e.to_string())?; + Ok(path) +} + +/// Builds the crate for WebAssembly: its component, and Cargo's target folder. +fn compile(root: &Path, release: bool) -> Result<(Vec, PathBuf), String> { let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into()); let mut cmd = Command::new(cargo); - cmd.args([ + cmd.current_dir(root).args([ "build", "--lib", "--target", @@ -145,17 +235,8 @@ fn build(release: bool) -> Result { .rfind(|f| f.extension().is_some_and(|e| e == "wasm")) .ok_or("the build made no .wasm: is the crate a cdylib?")?; let wasm = componentize(&std::fs::read(&core).map_err(|e| e.to_string())?)?; - // The game refuses a component importing capabilities the manifest lacks. - manifest.check_imports(component_imports(&wasm)?.iter().map(String::as_str))?; - let target_dir = core.ancestors().nth(3).ok_or("unexpected target folder")?; - let dir = target_dir.join("horizon-mod"); - std::fs::create_dir_all(&dir).map_err(|e| e.to_string())?; - let path = dir.join(format!("{}.hmod", manifest.id)); - // Write then rename, so a running game never reads half a file. - let partial = path.with_extension("hmod.partial"); - std::fs::write(&partial, Package::write(&manifest_text, &wasm)?).map_err(|e| e.to_string())?; - std::fs::rename(&partial, &path).map_err(|e| e.to_string())?; - Ok(path) + let target = core.ancestors().nth(3).ok_or("unexpected target folder")?; + Ok((wasm, target.to_path_buf())) } /// `check `: the registry's checks of a submission, printed; fails @@ -237,4 +318,49 @@ mod tests { ); std::fs::remove_dir_all(&dir).unwrap(); } + + #[test] + fn the_content_template_builds_and_checks_with_no_code() { + let dir = std::env::temp_dir().join(format!("horizon-mod-content-{}", std::process::id())); + let path = dir.join("gems"); + let new_args = [ + path.display().to_string(), + "--template".into(), + "content".into(), + ]; + new(&new_args).unwrap(); + assert!(!path.join("Cargo.toml").exists()); + let hmod = build_in(&path, true).unwrap(); + assert_eq!(hmod, path.join("target/horizon-mod/gems.hmod")); + let package = Package::read(&hmod).unwrap(); + assert!(package.wasm.is_none()); + let content = Content::read(&hmod, &package.manifest).unwrap(); + assert!( + content + .files + .contains(&"data/gems/horizon/block/glowing_amethyst.json".into()) + ); + assert_eq!(content.files.len(), 8, "{:?}", content.files); + let report = check::check(&hmod, check::kind_of(&hmod).unwrap(), None, None).unwrap(); + assert!(!report.code); + assert!( + report.text().contains("no code: content only"), + "{}", + report.text() + ); + // Without registries, a mod needs code. + let manifest = std::fs::read_to_string(path.join(MANIFEST)).unwrap(); + let manifest = manifest.replace("[\"registries\"]", "[]"); + std::fs::write(path.join(MANIFEST), manifest).unwrap(); + assert!(build_in(&path, true).unwrap_err().contains("no Cargo.toml")); + assert!( + new(&[ + dir.join("x").display().to_string(), + "--template".into(), + "lua".into() + ]) + .is_err() + ); + std::fs::remove_dir_all(&dir).unwrap(); + } } diff --git a/crates/cargo-horizon-mod/template/content/block.json b/crates/cargo-horizon-mod/template/content/block.json new file mode 100644 index 000000000..ea68a1a27 --- /dev/null +++ b/crates/cargo-horizon-mod/template/content/block.json @@ -0,0 +1,4 @@ +{ + "template": "minecraft:amethyst_block", + "properties": { "hardness": 2.0, "light": 7 } +} diff --git a/crates/cargo-horizon-mod/template/content/blockstate.json b/crates/cargo-horizon-mod/template/content/blockstate.json new file mode 100644 index 000000000..ea472666e --- /dev/null +++ b/crates/cargo-horizon-mod/template/content/blockstate.json @@ -0,0 +1,5 @@ +{ + "variants": { + "": { "model": "{id}:block/glowing_amethyst" } + } +} diff --git a/crates/cargo-horizon-mod/template/content/horizon-mod.toml b/crates/cargo-horizon-mod/template/content/horizon-mod.toml new file mode 100644 index 000000000..4f133a905 --- /dev/null +++ b/crates/cargo-horizon-mod/template/content/horizon-mod.toml @@ -0,0 +1,10 @@ +id = "{id}" +name = "{name}" +version = "0.1.0" +description = "" +authors = [] +# A content mod: blocks and items from data/ and assets/, no code (API 0.2). +api = "0.2" +side = "both" +# registries: "May add blocks and items to your worlds". +capabilities = ["registries"] diff --git a/crates/cargo-horizon-mod/template/content/item.json b/crates/cargo-horizon-mod/template/content/item.json new file mode 100644 index 000000000..411bc4499 --- /dev/null +++ b/crates/cargo-horizon-mod/template/content/item.json @@ -0,0 +1,3 @@ +{ + "model": { "type": "minecraft:model", "model": "{id}:block/glowing_amethyst" } +} diff --git a/crates/cargo-horizon-mod/template/content/lang.json b/crates/cargo-horizon-mod/template/content/lang.json new file mode 100644 index 000000000..74baddab8 --- /dev/null +++ b/crates/cargo-horizon-mod/template/content/lang.json @@ -0,0 +1,3 @@ +{ + "block.{id}.glowing_amethyst": "Glowing Amethyst" +} diff --git a/crates/cargo-horizon-mod/template/content/loot.json b/crates/cargo-horizon-mod/template/content/loot.json new file mode 100644 index 000000000..898111f1b --- /dev/null +++ b/crates/cargo-horizon-mod/template/content/loot.json @@ -0,0 +1,11 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "condition": { "type": "minecraft:survives_explosion" }, + "entries": [{ "type": "minecraft:item", "name": "{id}:glowing_amethyst" }], + "rolls": 1 + } + ], + "random_sequence": "{id}:blocks/glowing_amethyst" +} diff --git a/crates/cargo-horizon-mod/template/content/model.json b/crates/cargo-horizon-mod/template/content/model.json new file mode 100644 index 000000000..5710fecb1 --- /dev/null +++ b/crates/cargo-horizon-mod/template/content/model.json @@ -0,0 +1,4 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { "all": "minecraft:block/amethyst_block" } +} diff --git a/crates/cargo-horizon-mod/template/content/pickaxe.json b/crates/cargo-horizon-mod/template/content/pickaxe.json new file mode 100644 index 000000000..8725edebd --- /dev/null +++ b/crates/cargo-horizon-mod/template/content/pickaxe.json @@ -0,0 +1,3 @@ +{ + "values": ["{id}:glowing_amethyst"] +} diff --git a/crates/cargo-horizon-mod/template/content/recipe.json b/crates/cargo-horizon-mod/template/content/recipe.json new file mode 100644 index 000000000..5edb03d94 --- /dev/null +++ b/crates/cargo-horizon-mod/template/content/recipe.json @@ -0,0 +1,6 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "building", + "ingredients": ["minecraft:amethyst_block", "minecraft:glowstone_dust"], + "result": { "id": "{id}:glowing_amethyst" } +} diff --git a/docs/api/mods.md b/docs/api/mods.md index 3e6108c70..5c323a0e1 100644 --- a/docs/api/mods.md +++ b/docs/api/mods.md @@ -19,7 +19,7 @@ the player before the mod is turned on, and checked against the component's real | 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 | -| `cargo horizon-mod` | `new`, `build`, `run` | +| `cargo horizon-mod` | `new` (templates `code` and `content`), `build`, `run`, `check` | | Example mods | `coords-hud` (code), `ruby-content` (content) | ## Guide @@ -58,6 +58,7 @@ scripting runtime in the game. | Way in | For | Status | Template and example | | --- | --- | --- | --- | | Rust | most mods; the fastest | first-class: the SDK, `cargo horizon-mod` | `cargo horizon-mod new`, `coords-hud` | +| Data only | blocks and items with no code | first-class: content mods (API 0.2) | `cargo horizon-mod new --template content`, `ruby-content` | | Lua scripts | people who don't want a compiler | planned: a script mod whose code is a `.lua` file, run by Horizon's own interpreter mod | planned, with the same example as Rust | | C, C++, Zig | authors of those languages | to evaluate: bindings generated from the WIT, built without WASI | one each if it passes | | Go (TinyGo), AssemblyScript, JavaScript / TypeScript | authors of those languages | to evaluate: each needs its toolchain to emit a component without WASI imports, or an interpreter mod as for Lua | one each if it passes | diff --git a/docs/mods.md b/docs/mods.md index bac207f60..3a4473032 100644 --- a/docs/mods.md +++ b/docs/mods.md @@ -16,7 +16,7 @@ folder, loads no runtime and plays exactly like vanilla 26.3. | SDK for mod authors | `crates/horizon-mod-sdk` | 0.1 | | Example mod | `crates/horizon-mod-sdk/examples/coords-hud` | coordinates, facing and time HUD, `/where`, `/coords` | | Runtime | `crates/horizon-mods` | wasmtime 36 LTS, component model | -| Authoring tool | `crates/cargo-horizon-mod` | `cargo horizon-mod new / build / run / check`, and the registry's CI (`registry build / review / list`) | +| Authoring tool | `crates/cargo-horizon-mod` | `cargo horizon-mod new [--template code\|content] / build / run / check`, and the registry's CI (`registry build / review / list`) | | In the game | `crates/horizon-client/src/game/mods.rs`, Options > Mods | client mods | | Launcher mod browser (Modrinth, CurseForge with a key) | [mod-browser.md](mod-browser.md) | resource packs, modpacks | | Registry index (`index.json`, `.hpack`), signatures | `horizon_mods::index`, [api/mod-index.md](api/mod-index.md) | schema 1; launcher and website next | @@ -215,6 +215,7 @@ Benchmarks (`--benchmark`) never load mods. rustup target add wasm32-unknown-unknown cargo install --git https://github.com/ludovic111/horizon cargo-horizon-mod cargo horizon-mod new my-mod # Cargo.toml, horizon-mod.toml, src/lib.rs + # (--template content: a content mod, no code) cd my-mod cargo horizon-mod run # build, then start the game with it cargo horizon-mod build # again after an edit: the running game reloads it @@ -292,7 +293,10 @@ permission. ### Content mods (API 0.2) A mod with `api = "0.2"` and capability `registries` may carry `assets/` and -`data/` in the `.hmod`, and needs no `mod.wasm` if it has no code. It adds +`data/` in the `.hmod`, and needs no `mod.wasm` if it has no code +(`cargo horizon-mod new --template content` starts one; `build` in a folder +with no `Cargo.toml` packs the manifest, `assets/` and `data/`, and `check` +reads it without a trial run). It adds blocks and items by declaring them in `data//horizon/block/*.json` and `data//horizon/item/*.json`, each copying a vanilla template ([modpacks.md](modpacks.md#registries-02-data-driven-blocks-and-items)): diff --git a/website/docs/content-mods.md b/website/docs/content-mods.md index 1ad8cd5fb..9504bceb6 100644 --- a/website/docs/content-mods.md +++ b/website/docs/content-mods.md @@ -4,7 +4,7 @@ A content mod adds blocks and items to the game with data files only: no Rust, n ## What a content mod is -A folder (while you work on it) or a `.hmod` zip (to share it) holding a manifest, `assets/` and `data/`. This is the SDK's [`ruby-content`](https://github.com/ludovic111/horizon/tree/main/crates/horizon-mod-sdk/examples/ruby-content) example, a ruby gem and a block of ruby: +A folder (while you work on it) or a `.hmod` file (to share it) holding a manifest, `assets/` and `data/`. This is the SDK's [`ruby-content`](https://github.com/ludovic111/horizon/tree/main/crates/horizon-mod-sdk/examples/ruby-content) example, a ruby gem and a block of ruby: ``` ruby/ @@ -98,17 +98,27 @@ A mod made from a Java mod whose files use other names lists them in its manifes - Unknown keys in a block or item file are refused, and the mod stays off with the reason on its row. - Content mods work in single player today. Playing them together on a server is planned. +## Start one + +```sh +cargo horizon-mod new my-blocks --template content +``` + +makes a content mod with one block, Glowing Amethyst: an amethyst block that gives light, with its block state, model (using vanilla's amethyst texture), item model, name, loot table, a recipe (an amethyst block and glowstone dust) and the pickaxe tag. Rename and copy its files to add your own. + ## Try it and share it While you work, give the game the folder as a dev mod ([how](/docs/make-a-mod#see-it-in-the-game)): `--dev-mod "/path/to/ruby"`. The first start with a new set of mods takes a little longer while the game adds their content to its tables; after a change to the files, start the game again. -To share it, zip the folder's contents, with `horizon-mod.toml` at the top of the zip, and name the file `.hmod`: +To share it, build the `.hmod` in the mod's folder: ```sh -cd ruby -zip -r ../ruby.hmod horizon-mod.toml assets data +cargo horizon-mod build +cargo horizon-mod check target/horizon-mod/ruby.hmod ``` -Players put that file in their `horizon-mods` folder and turn it on in **Options, Mods...**. The registry doesn't take content-only mods yet: its checks (`cargo horizon-mod check`) expect code in the file. That is coming next. +A folder without a `Cargo.toml` is a content mod: `build` checks its files as the game will and packs the manifest, `assets/` and `data/` into `target/horizon-mod/.hmod`, with no compiler involved. `check` reads it as the registry does and says "no code: content only, nothing to run". Players put that file in their `horizon-mods` folder and turn it on in **Options, Mods...**, and you can [publish it](/docs/publish-a-mod) like any mod. + +A mod can have both: a `Cargo.toml` with code, and `assets/` and `data/` with content. `build` packs both. Next: [test it](/docs/test-a-mod). diff --git a/website/docs/make-a-mod.md b/website/docs/make-a-mod.md index 94c3deca2..89f2d8bcd 100644 --- a/website/docs/make-a-mod.md +++ b/website/docs/make-a-mod.md @@ -41,7 +41,7 @@ cargo horizon-mod new my-mod cd my-mod ``` -`new` makes a folder with a working mod in it: a `/hello` command that answers in chat. `--name "My Mod"` sets the name players see. The folder holds: +`new` makes a folder with a working mod in it: a `/hello` command that answers in chat. `--name "My Mod"` sets the name players see, and `--template content` makes a [content mod](/docs/content-mods) instead, with no code. The folder holds: ``` my-mod/