27d750f1c9
Second slice of the crate split, a pure move like the first: blocks (+ blocks/), items, item_data, enchant, cooldowns, bundle and random_sequences move to horizon-items. They are the first layer mobs/ needs, after horizon-client-core. Items moved out of lib modules that sit in the big cycle, unchanged: - firework shapes, explosions and dye colours (particles.rs) -> firework.rs; - BannerLayer and its NBT form (banner.rs) -> banner_layer.rs; - the ItemStack NBT codec (save.rs) -> item_nbt.rs; - consumable_animation (first_person.rs) -> use_animation.rs; - the content namespaces (mod_content.rs) -> content_namespaces.rs; - save.rs's NBT value helpers -> horizon-client-core's nbt_value.rs, and name_text (entity_nbt.rs) -> core's component.rs. horizon-client re-exports every module and item under its old path. Test helpers other client tests use (Items::for_tests, enchant::tests) are behind horizon-items' `test-support` feature, enabled by horizon-client's dev-dependency. The items test that loads the client's assets moved to the client: always_edible_and_consume_effects_loaded, to assets.rs. particles.rs' test module moved to the end of the file (clippy's items_after_test_module had been quiet only thanks to the derives that moved out). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.1 KiB
Rust
30 lines
1.1 KiB
Rust
//! The namespaces content mods add to a resource root, which loaders read
|
|
//! besides `minecraft`.
|
|
use std::{fs, path::Path};
|
|
|
|
/// In a root built here: the namespaces the content mods own (their ids and
|
|
/// listed namespaces), which loaders read besides `minecraft`.
|
|
pub const MARKER: &str = "horizon-mod-content.json";
|
|
|
|
/// The content mods' namespaces in a root built by `mod_content::build`; none in any
|
|
/// other root, so vanilla's loaders read exactly what they did.
|
|
pub fn namespaces(root: &Path) -> Vec<String> {
|
|
fs::read(root.join(MARKER))
|
|
.ok()
|
|
.and_then(|b| serde_json::from_slice(&b).ok())
|
|
.unwrap_or_default()
|
|
}
|
|
|
|
/// The namespaces whose tags loaders read in `root`: `minecraft`, and in a
|
|
/// root built by `mod_content::build` the convention tags (`c`, shared between mods as
|
|
/// on NeoForge and Fabric) and the content mods' own.
|
|
pub fn tag_namespaces(root: &Path) -> Vec<String> {
|
|
let mods = namespaces(root);
|
|
let mut out = vec!["minecraft".to_owned()];
|
|
if !mods.is_empty() {
|
|
out.push("c".to_owned());
|
|
out.extend(mods);
|
|
}
|
|
out
|
|
}
|