From ac7b7f98c0292ead567c90b4553bdbd911128329 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Fri, 16 Oct 2026 19:13:17 +0200 Subject: [PATCH] Content mods in the game: loot, recipes, models, names and icons from mod namespaces The game builds the content root from the enabled content mods at startup. Loaders that only read the minecraft namespace now also read the content mods' namespaces (from the root's marker file): block loot tables, recipes, blockstates, language files, and the HUD atlas's item sprites. /give and the command registries know the new items and blocks. A block without a blockstate of its own takes its template's, so every state has a model. Adds examples/ruby-content, a folder content mod: a ruby block and a ruby item with recipes, loot, tags, models, textures and names. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/crafting.rs | 39 +++++++++---- crates/horizon-client/src/creative.rs | 21 ++++--- crates/horizon-client/src/game.rs | 5 ++ crates/horizon-client/src/game/mods.rs | 54 ++++++++++++++++++ crates/horizon-client/src/hud.rs | 6 +- crates/horizon-client/src/items.rs | 38 ++++++++---- crates/horizon-client/src/mod_content.rs | 41 ++++++++++++- .../horizon-client/src/mod_content_tests.rs | 5 ++ crates/horizon-client/src/models.rs | 2 +- crates/horizon-client/src/models/catalog.rs | 6 +- .../assets/ruby/blockstates/ruby_block.json | 7 +++ .../ruby-content/assets/ruby/items/ruby.json | 6 ++ .../assets/ruby/items/ruby_block.json | 6 ++ .../ruby-content/assets/ruby/lang/en_us.json | 4 ++ .../assets/ruby/models/block/ruby_block.json | 6 ++ .../assets/ruby/models/item/ruby.json | 6 ++ .../assets/ruby/textures/block/ruby_block.png | Bin 0 -> 149 bytes .../assets/ruby/textures/item/ruby.png | Bin 0 -> 149 bytes .../tags/block/mineable/pickaxe.json | 5 ++ .../minecraft/tags/block/needs_iron_tool.json | 5 ++ .../data/ruby/horizon/block/ruby_block.json | 9 +++ .../data/ruby/horizon/item/ruby.json | 4 ++ .../ruby/loot_table/blocks/ruby_block.json | 18 ++++++ .../data/ruby/recipe/ruby_block.json | 15 +++++ .../ruby/recipe/ruby_from_ruby_block.json | 10 ++++ .../examples/ruby-content/horizon-mod.toml | 11 ++++ 26 files changed, 294 insertions(+), 35 deletions(-) create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/blockstates/ruby_block.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby_block.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/lang/en_us.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/block/ruby_block.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/item/ruby.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/textures/block/ruby_block.png create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/textures/item/ruby.png create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/data/minecraft/tags/block/mineable/pickaxe.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/data/minecraft/tags/block/needs_iron_tool.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/data/ruby/horizon/block/ruby_block.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/data/ruby/horizon/item/ruby.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/data/ruby/loot_table/blocks/ruby_block.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/data/ruby/recipe/ruby_block.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/data/ruby/recipe/ruby_from_ruby_block.json create mode 100644 crates/horizon-mod-sdk/examples/ruby-content/horizon-mod.toml diff --git a/crates/horizon-client/src/crafting.rs b/crates/horizon-client/src/crafting.rs index e4a70811a..457ddf497 100644 --- a/crates/horizon-client/src/crafting.rs +++ b/crates/horizon-client/src/crafting.rs @@ -14,7 +14,7 @@ use serde_json::Value; use std::{ collections::{HashMap, HashSet}, fs, - path::Path, + path::{Path, PathBuf}, sync::Arc, }; @@ -1182,18 +1182,33 @@ impl Recipes { let mut crafting = Vec::new(); let mut cooking = Vec::new(); let mut meta = HashMap::new(); - let mut files: Vec<_> = fs::read_dir(root.join("data/minecraft/recipe"))? - .flatten() - .map(|e| e.path()) - .filter(|p| p.extension().is_some_and(|e| e == "json")) + let json_files = |dir: &Path| -> Result> { + let mut files: Vec<_> = fs::read_dir(dir)? + .flatten() + .map(|e| e.path()) + .filter(|p| p.extension().is_some_and(|e| e == "json")) + .collect(); + files.sort(); + Ok(files) + }; + // Vanilla's recipes by bare name, then content mods' as `:`. + let mut files: Vec<(String, PathBuf)> = json_files(&root.join("data/minecraft/recipe"))? + .into_iter() + .map(|p| (String::new(), p)) .collect(); - files.sort(); - for path in files { - let name = path - .file_stem() - .and_then(|s| s.to_str()) - .unwrap_or("") - .to_owned(); + for namespace in crate::mod_content::namespaces(root) { + let dir = root.join(format!("data/{namespace}/recipe")); + if dir.is_dir() { + files.extend( + json_files(&dir)? + .into_iter() + .map(|p| (format!("{namespace}:"), p)), + ); + } + } + for (prefix, path) in files { + let stem = path.file_stem().and_then(|s| s.to_str()).unwrap_or(""); + let name = format!("{prefix}{stem}"); let v: Value = serde_json::from_slice(&fs::read(&path)?)?; let text = |k: &str| v[k].as_str().unwrap_or("").to_owned(); meta.insert(name.clone(), (text("category"), text("group"))); diff --git a/crates/horizon-client/src/creative.rs b/crates/horizon-client/src/creative.rs index 942bf13b9..80445d541 100644 --- a/crates/horizon-client/src/creative.rs +++ b/crates/horizon-client/src/creative.rs @@ -49,17 +49,24 @@ pub struct Names { } impl Names { pub fn load(root: &Path) -> Self { - let map = fs::read(root.join("assets/minecraft/lang/en_us.json")) - .ok() - .and_then(|b| serde_json::from_slice::>(&b).ok()) - .unwrap_or_default(); + let read = |namespace: &str| { + fs::read(root.join(format!("assets/{namespace}/lang/en_us.json"))) + .ok() + .and_then(|b| serde_json::from_slice::>(&b).ok()) + .unwrap_or_default() + }; + let mut map = read("minecraft"); + // Content mods' names (docs/modpacks.md); none in a vanilla root. + for namespace in crate::mod_content::namespaces(root) { + map.extend(read(&namespace)); + } Self { map } } pub fn item(&self, id: &str) -> String { - let path = id.trim_start_matches("minecraft:"); + let (namespace, path) = id.split_once(':').unwrap_or(("minecraft", id)); self.map - .get(&format!("item.minecraft.{path}")) - .or_else(|| self.map.get(&format!("block.minecraft.{path}"))) + .get(&format!("item.{namespace}.{path}")) + .or_else(|| self.map.get(&format!("block.{namespace}.{path}"))) .cloned() .unwrap_or_else(|| path.replace('_', " ")) } diff --git a/crates/horizon-client/src/game.rs b/crates/horizon-client/src/game.rs index 7072abeb5..fb83c291f 100644 --- a/crates/horizon-client/src/game.rs +++ b/crates/horizon-client/src/game.rs @@ -9746,6 +9746,11 @@ pub fn run() -> Result<()> { let vanilla_root = options.resources.clone(); let early_settings = Settings::load(&std::env::current_dir()?.join("options.txt")); options.resources = packs::startup_root(&vanilla_root, &early_settings.resource_packs); + options.resources = mods::content_root( + &options.resources, + &early_settings.mods.enabled, + &options.dev_mods, + ); let assets = match Assets::load(&options.resources) { Ok(assets) => assets, // Minecraft.rollbackResourcePacks: the packs break loading, start diff --git a/crates/horizon-client/src/game/mods.rs b/crates/horizon-client/src/game/mods.rs index 56cb1d0d8..939cb671d 100644 --- a/crates/horizon-client/src/game/mods.rs +++ b/crates/horizon-client/src/game/mods.rs @@ -47,6 +47,60 @@ fn vanilla_command(name: &str) -> bool { .any(|&c| d.nodes[c].name() == name) } +/// `root` with the content mods that are on layered over it +/// (docs/modpacks.md): their blocks, items, data and assets. Read once at +/// start, before the resources load; a mod whose content is refused is left +/// out here and its row on the Mods page says why. +pub(super) fn content_root( + root: &std::path::Path, + enabled: &std::collections::BTreeSet, + dev: &[std::path::PathBuf], +) -> std::path::PathBuf { + use horizon_client::mod_content::{self, ContentMod}; + use horizon_mods::{Capability, Content, Package}; + let here = std::env::current_dir().unwrap_or_default(); + let mut paths = horizon_mods::find(&here.join(mod_list::DIR)); + paths.retain(|p| !dev.contains(p)); + paths.extend(dev.iter().cloned()); + let mut mods: Vec = Vec::new(); + for path in &paths { + let Ok(package) = Package::read(path) else { + continue; + }; + let m = &package.manifest; + let on = enabled.contains(&m.id) || dev.contains(path); + if !on + || !m.capabilities.contains(&Capability::Registries) + || mods.iter().any(|c| c.id == m.id) + { + continue; + } + match Content::read(path, m) { + Ok(content) => mods.push(ContentMod { + id: m.id.clone(), + content, + }), + Err(e) => log::warn!("Horizon: mod {} content not loaded: {e}", m.id), + } + } + match mod_content::resource_root(root, &mods, &here.join(".horizon-cache")) { + Ok(out) => { + if out != root { + log::info!( + "Horizon: content from {} mod(s) in {}", + mods.len(), + out.display() + ); + } + out + } + Err(e) => { + log::warn!("Horizon: content mods not loaded: {e}"); + root.to_owned() + } + } +} + impl Game<'_> { /// Reads `horizon-mods/` and the dev mods, and starts the ones turned on. pub(super) fn start_mods(&mut self) { diff --git a/crates/horizon-client/src/hud.rs b/crates/horizon-client/src/hud.rs index e73803ee7..cf4861458 100644 --- a/crates/horizon-client/src/hud.rs +++ b/crates/horizon-client/src/hud.rs @@ -102,8 +102,10 @@ fn atlas_sprites(root: &Path, packed: &[PackedImage]) -> Vec { let image = match &origin { SpriteOrigin::File(texture) => { let path = texture.strip_prefix("minecraft:").unwrap_or(texture); - // Packed under its own name already: only a renamed file is new. - if path == name { + // A vanilla file is packed under its own name already: + // only a renamed one is new. Other namespaces' files + // (content mods) are never in the walked directories. + if texture.starts_with("minecraft:") && path == name { continue; } load(texture, "textures").map(|(w, h, p)| { diff --git a/crates/horizon-client/src/items.rs b/crates/horizon-client/src/items.rs index bf49efec7..0aca99cef 100644 --- a/crates/horizon-client/src/items.rs +++ b/crates/horizon-client/src/items.rs @@ -512,11 +512,16 @@ impl Items { let mut loot = HashMap::new(); // Every loot table, keyed by its id (blocks/stone, entities/sheep/white, // gameplay/chicken_lay, shearing/sheep/red...). - fn walk_loot(dir: &Path, base: &Path, loot: &mut HashMap) -> Result<()> { + fn walk_loot( + dir: &Path, + base: &Path, + namespace: &str, + loot: &mut HashMap, + ) -> Result<()> { for entry in fs::read_dir(dir)?.flatten() { let p = entry.path(); if p.is_dir() { - walk_loot(&p, base, loot)?; + walk_loot(&p, base, namespace, loot)?; } else if p.extension().is_some_and(|e| e == "json") { let id = p .strip_prefix(base)? @@ -524,7 +529,7 @@ impl Items { .to_string_lossy() .replace('\\', "/"); loot.insert( - format!("minecraft:{id}"), + format!("{namespace}:{id}"), serde_json::from_slice(&fs::read(&p)?)?, ); } @@ -532,7 +537,14 @@ impl Items { Ok(()) } let loot_root = root.join("data/minecraft/loot_table"); - walk_loot(&loot_root, &loot_root, &mut loot)?; + walk_loot(&loot_root, &loot_root, "minecraft", &mut loot)?; + // Content mods' tables (docs/modpacks.md): `:blocks/...`. + for namespace in crate::mod_content::namespaces(root) { + let dir = root.join(format!("data/{namespace}/loot_table")); + if dir.is_dir() { + walk_loot(&dir, &dir, &namespace, &mut loot)?; + } + } let registry_order = registry_order(root, &order); Ok(Self { items, @@ -644,12 +656,15 @@ impl Items { state: BlockStateId, ) -> Option { let block = registry.state(state)?; - let name = block.name.trim_start_matches("minecraft:"); + let (namespace, name) = block + .name + .split_once(':') + .unwrap_or(("minecraft", &block.name)); let standing = name.replacen("_wall_", "_", 1); let standing = standing.strip_prefix("wall_").unwrap_or(&standing); let standing = standing.replacen("wall_", "", 1); - self.loot_sequence(&format!("minecraft:blocks/{name}")) - .or_else(|| self.loot_sequence(&format!("minecraft:blocks/{standing}"))) + self.loot_sequence(&format!("{namespace}:blocks/{name}")) + .or_else(|| self.loot_sequence(&format!("{namespace}:blocks/{standing}"))) } /// Evaluate the block's loot table for a player break without explosions. pub fn block_drops( @@ -737,7 +752,10 @@ impl Items { let Some(block) = registry.state(state) else { return vec![]; }; - let name = block.name.trim_start_matches("minecraft:"); + let (namespace, name) = block + .name + .split_once(':') + .unwrap_or(("minecraft", &block.name)); // `Blocks.wallVariant`: wall signs, banners, heads, fans and torches // reuse the standing block's loot table. let standing = name.replacen("_wall_", "_", 1); @@ -745,8 +763,8 @@ impl Items { let standing = standing.replacen("wall_", "", 1); let table = self .loot - .get(&format!("minecraft:blocks/{name}")) - .or_else(|| self.loot.get(&format!("minecraft:blocks/{standing}"))); + .get(&format!("{namespace}:blocks/{name}")) + .or_else(|| self.loot.get(&format!("{namespace}:blocks/{standing}"))); let Some(table) = table else { return vec![]; }; diff --git a/crates/horizon-client/src/mod_content.rs b/crates/horizon-client/src/mod_content.rs index 106d73010..3a8c2920e 100644 --- a/crates/horizon-client/src/mod_content.rs +++ b/crates/horizon-client/src/mod_content.rs @@ -524,10 +524,19 @@ impl<'a> Plan<'a> { "items.json" => self.items(doc, true), "command-registries.json" => { self.names(doc.at("blocks").ok_or("no blocks")?, false); + let new_items = || self.items.iter().map(|i| J::Str(i.rename.to.clone())); + let new_blocks = || self.blocks.iter().map(|b| J::Str(b.decl.id.clone())); let Some(J::Arr(items)) = doc.at("items") else { return Err("no items".into()); }; - items.extend(self.items.iter().map(|i| J::Str(i.rename.to.clone()))); + items.extend(new_items()); + // The registries commands check ids against. + if let Some(J::Arr(ids)) = doc.at("by_registry/minecraft:item/ids") { + ids.extend(new_items()); + } + if let Some(J::Arr(ids)) = doc.at("by_registry/minecraft:block/ids") { + ids.extend(new_blocks()); + } } "mob-data.json" => states(doc, "states", false, false)?, "worldgen/block_flags.json" => states(doc, "", false, false)?, @@ -616,6 +625,19 @@ const NBT_TABLES: [&str; 6] = [ "worldgen/blocks/cached-support.nbt", "worldgen/blocks/cached-collision.nbt", ]; +/// In a root built here: the content mods' ids, the namespaces loaders +/// read besides `minecraft`. +const MARKER: &str = "horizon-mod-content.json"; + +/// The content mods' namespaces in a root built by [`build`]; none in any +/// other root, so vanilla's loaders read exactly what they did. +pub fn namespaces(root: &Path) -> Vec { + fs::read(root.join(MARKER)) + .ok() + .and_then(|b| serde_json::from_slice(&b).ok()) + .unwrap_or_default() +} + /// Bundles of block tag files (tag id → the tag file's text). const TAG_BUNDLES: [&str; 2] = ["block-tags.json", "worldgen/block_tags.json"]; @@ -799,6 +821,23 @@ pub fn build(base: &Path, mods: &[ContentMod], out: &Path) -> Result<()> { for (name, doc) in &bundles { overlay.write(name, &serde_json::to_vec(doc)?)?; } + // A block without its own blockstate looks like its template, so every + // state still has a model. + for m in mods { + for block in &m.content.blocks { + let (ns, path) = block.id.split_once(':').unwrap_or((&m.id, &block.id)); + let own = format!("assets/{ns}/blockstates/{path}.json"); + if m.content.files.contains(&own) { + continue; + } + let template = block.template.trim_start_matches("minecraft:"); + let vanilla = base.join(format!("assets/minecraft/blockstates/{template}.json")); + overlay.write(&own, &fs::read(&vanilla)?)?; + } + } + let mut ids: Vec<&str> = mods.iter().map(|m| m.id.as_str()).collect(); + ids.sort(); + overlay.write(MARKER, &serde_json::to_vec(&ids)?)?; Ok(()) } diff --git a/crates/horizon-client/src/mod_content_tests.rs b/crates/horizon-client/src/mod_content_tests.rs index b5f235916..6dd92ecfd 100644 --- a/crates/horizon-client/src/mod_content_tests.rs +++ b/crates/horizon-client/src/mod_content_tests.rs @@ -177,6 +177,11 @@ fn content_root_loads_with_every_table() { crate::motion::MotionResources::load(&root, &assets).unwrap(); horizon_world::worldgen::generator::GeneratorData::load(&root.join("worldgen"), new).unwrap(); assert!(root.join("assets/ruby/lang/en_us.json").is_file()); + // Blocks without a blockstate of their own take their template's. + assert_eq!( + fs::read(root.join("assets/ruby/blockstates/ruby_door.json")).unwrap(), + fs::read(base.join("assets/minecraft/blockstates/oak_door.json")).unwrap() + ); // The base root was only read. assert!( diff --git a/crates/horizon-client/src/models.rs b/crates/horizon-client/src/models.rs index 85d90b087..ba5bffefb 100644 --- a/crates/horizon-client/src/models.rs +++ b/crates/horizon-client/src/models.rs @@ -73,7 +73,7 @@ pub(crate) fn prepare_with_models( let blocks: Vec<&str> = facts .keys() .filter(|name| registry.default_state(name).is_some()) - .filter_map(|name| name.strip_prefix("minecraft:")) + .map(|name| name.strip_prefix("minecraft:").unwrap_or(name)) .collect(); let catalog = StateModels::from_facts_with_models(root, registry, &blocks, sprites, &facts, models)?; diff --git a/crates/horizon-client/src/models/catalog.rs b/crates/horizon-client/src/models/catalog.rs index 59a885821..cccf08900 100644 --- a/crates/horizon-client/src/models/catalog.rs +++ b/crates/horizon-client/src/models/catalog.rs @@ -94,7 +94,9 @@ impl StateModels { } } for block in blocks.iter().copied().collect::>() { - let name = format!("minecraft:{block}"); + // Vanilla blocks come bare; content mods' blocks with their namespace. + let (namespace, path) = block.split_once(':').unwrap_or(("minecraft", block)); + let name = format!("{namespace}:{path}"); let facts = facts.get(&name).ok_or("missing block model state schema")?; let schema: PropertySchema = facts["schema"] .as_object() @@ -133,7 +135,7 @@ impl StateModels { .collect::>()?; let possible: Vec = serde_json::from_value(facts["states"].clone())?; let resource = fs::read_to_string( - root.join(format!("assets/minecraft/blockstates/{block}.json")), + root.join(format!("assets/{namespace}/blockstates/{path}.json")), )?; let definition = BlockStateDefinition::from_json(&resource)?; let bound = definition.bind(&schema, &possible)?; diff --git a/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/blockstates/ruby_block.json b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/blockstates/ruby_block.json new file mode 100644 index 000000000..53d9292f2 --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/blockstates/ruby_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "ruby:block/ruby_block" + } + } +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby.json b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby.json new file mode 100644 index 000000000..683211550 --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "ruby:item/ruby" + } +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby_block.json b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby_block.json new file mode 100644 index 000000000..7cd81eb4d --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/items/ruby_block.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "ruby:block/ruby_block" + } +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/lang/en_us.json b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/lang/en_us.json new file mode 100644 index 000000000..0b1723511 --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/lang/en_us.json @@ -0,0 +1,4 @@ +{ + "block.ruby.ruby_block": "Block of Ruby", + "item.ruby.ruby": "Ruby" +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/block/ruby_block.json b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/block/ruby_block.json new file mode 100644 index 000000000..e29b03d89 --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/block/ruby_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "ruby:block/ruby_block" + } +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/item/ruby.json b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/item/ruby.json new file mode 100644 index 000000000..8589c680f --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/models/item/ruby.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "ruby:item/ruby" + } +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/textures/block/ruby_block.png b/crates/horizon-mod-sdk/examples/ruby-content/assets/ruby/textures/block/ruby_block.png new file mode 100644 index 0000000000000000000000000000000000000000..c6e4eeaf2b6023df2dfe5faed484a150fd8300d3 GIT binary patch literal 149 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`F`h1tAr-fhPY4J6@#joq5cHoK z^MCy$lVb-I3MG!I@tZR&lbD^BVz+{G}T@x>>JM28dS yUwqQo=+HC2@EFs^I<=b(7fT$@mpE{;F`S?B!{FkAd0T+?FnGH9xvX7RVqreg;b3MG!I@tZR&lbD^BVz+{G}T@x>>JM28dS xUwqQo=+HC2@EFs^I<=b(7fT$@mpE{;F?{~4u+)1)t0T}J22WQ%mvv4FO#t8qHlP3i literal 0 HcmV?d00001 diff --git a/crates/horizon-mod-sdk/examples/ruby-content/data/minecraft/tags/block/mineable/pickaxe.json b/crates/horizon-mod-sdk/examples/ruby-content/data/minecraft/tags/block/mineable/pickaxe.json new file mode 100644 index 000000000..d39b250dc --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/data/minecraft/tags/block/mineable/pickaxe.json @@ -0,0 +1,5 @@ +{ + "values": [ + "ruby:ruby_block" + ] +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/data/minecraft/tags/block/needs_iron_tool.json b/crates/horizon-mod-sdk/examples/ruby-content/data/minecraft/tags/block/needs_iron_tool.json new file mode 100644 index 000000000..d39b250dc --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/data/minecraft/tags/block/needs_iron_tool.json @@ -0,0 +1,5 @@ +{ + "values": [ + "ruby:ruby_block" + ] +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/horizon/block/ruby_block.json b/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/horizon/block/ruby_block.json new file mode 100644 index 000000000..a07c26d08 --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/horizon/block/ruby_block.json @@ -0,0 +1,9 @@ +{ + "template": "minecraft:iron_block", + "properties": { + "hardness": 4.0, + "light": 3, + "sounds": "minecraft:amethyst_block", + "map_color": 28 + } +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/horizon/item/ruby.json b/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/horizon/item/ruby.json new file mode 100644 index 000000000..4c89fe38f --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/horizon/item/ruby.json @@ -0,0 +1,4 @@ +{ + "template": "minecraft:diamond", + "rarity": "uncommon" +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/loot_table/blocks/ruby_block.json b/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/loot_table/blocks/ruby_block.json new file mode 100644 index 000000000..e58b73946 --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/loot_table/blocks/ruby_block.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "condition": { + "type": "minecraft:survives_explosion" + }, + "entries": [ + { + "type": "minecraft:item", + "name": "ruby:ruby_block" + } + ], + "rolls": 1 + } + ], + "random_sequence": "ruby:blocks/ruby_block" +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/recipe/ruby_block.json b/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/recipe/ruby_block.json new file mode 100644 index 000000000..da374d024 --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/recipe/ruby_block.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "building", + "key": { + "#": "ruby:ruby" + }, + "pattern": [ + "###", + "###", + "###" + ], + "result": { + "id": "ruby:ruby_block" + } +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/recipe/ruby_from_ruby_block.json b/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/recipe/ruby_from_ruby_block.json new file mode 100644 index 000000000..dc416fa2f --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/data/ruby/recipe/ruby_from_ruby_block.json @@ -0,0 +1,10 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + "ruby:ruby_block" + ], + "result": { + "count": 9, + "id": "ruby:ruby" + } +} diff --git a/crates/horizon-mod-sdk/examples/ruby-content/horizon-mod.toml b/crates/horizon-mod-sdk/examples/ruby-content/horizon-mod.toml new file mode 100644 index 000000000..39355bb57 --- /dev/null +++ b/crates/horizon-mod-sdk/examples/ruby-content/horizon-mod.toml @@ -0,0 +1,11 @@ +# A content-only Horizon mod (API 0.2, docs/modpacks.md): no code, a block +# and an item declared from vanilla templates, with their recipes, loot, +# tags, models, textures and names. Try it: horizon-client --dev-mod +id = "ruby" +name = "Ruby" +version = "0.1.0" +description = "A ruby gem and a block of ruby" +authors = ["Horizon"] +api = "0.2" +side = "both" +capabilities = ["registries"]