use yog_ids::texture_slot as slot;
use yog_ids::word::GUI;
pub const DIRECTIONS: &[&str] = yog_ids::direction::ALL_VALUES;
pub const DISPLAY_SLOTS: [&str; 8] = [
"thirdperson_righthand",
"thirdperson_lefthand",
"firstperson_righthand",
"firstperson_lefthand",
GUI,
"head",
"ground",
"fixed",
];
pub const RENDER_LAYERS: [&str; 4] = ["solid", "cutout", "cutout_mipped", "translucent"];
pub struct Template {
pub name: &'static str,
pub parent: &'static str,
pub slots: &'static [&'static str],
pub sprite: bool,
pub has_particle: bool,
}
macro_rules! template {
($dir:ident, $name:expr, $slots:expr, sprite: $sprite:expr, particle: $particle:expr) => {
Template {
name: $name,
parent: yog_ids::id!(
yog_ids::ns::MINECRAFT,
yog_ids::concatcp!(yog_ids::res::$dir, $name)
),
slots: $slots,
sprite: $sprite,
has_particle: $particle,
}
};
}
const SPRITE_SLOTS: &[&str] = &[yog_ids::model::LAYER0];
pub const TEMPLATES: &[Template] = &[
template!(BLOCK_DIR, "cube_all", &[slot::ALL], sprite: false, particle: true),
template!(BLOCK_DIR, "cube_column", &[slot::END, slot::SIDE], sprite: false, particle: true),
template!(BLOCK_DIR, "cube_bottom_top", &[slot::TOP, slot::BOTTOM, slot::SIDE], sprite: false, particle: true),
template!(BLOCK_DIR, "cube", &DIRECTIONS, sprite: false, particle: false),
template!(BLOCK_DIR, "orientable", &[slot::FRONT, slot::SIDE, slot::TOP], sprite: false, particle: true),
template!(BLOCK_DIR, "cross", &["cross"], sprite: false, particle: true),
template!(ITEM_DIR, "generated", SPRITE_SLOTS, sprite: true, particle: true),
template!(ITEM_DIR, "handheld", SPRITE_SLOTS, sprite: true, particle: true),
];
pub fn template(name: &str) -> Option<&'static Template> {
TEMPLATES.iter().find(|t| t.name == name)
}