1use yog_ids::texture_slot as slot;
5use yog_ids::word::GUI;
6
7pub const DIRECTIONS: &[&str] = yog_ids::direction::ALL_VALUES;
9pub const DISPLAY_SLOTS: [&str; 8] = [
11 "thirdperson_righthand",
12 "thirdperson_lefthand",
13 "firstperson_righthand",
14 "firstperson_lefthand",
15 GUI,
16 "head",
17 "ground",
18 "fixed",
19];
20pub const RENDER_LAYERS: [&str; 4] = ["solid", "cutout", "cutout_mipped", "translucent"];
22
23pub struct Template {
25 pub name: &'static str,
26 pub parent: &'static str,
28 pub slots: &'static [&'static str],
30 pub sprite: bool,
32 pub has_particle: bool,
34}
35
36macro_rules! template {
38 ($dir:ident, $name:expr, $slots:expr, sprite: $sprite:expr, particle: $particle:expr) => {
39 Template {
40 name: $name,
41 parent: yog_ids::id!(
42 yog_ids::ns::MINECRAFT,
43 yog_ids::concatcp!(yog_ids::res::$dir, $name)
44 ),
45 slots: $slots,
46 sprite: $sprite,
47 has_particle: $particle,
48 }
49 };
50}
51
52const SPRITE_SLOTS: &[&str] = &[yog_ids::model::LAYER0];
54
55pub const TEMPLATES: &[Template] = &[
56 template!(BLOCK_DIR, "cube_all", &[slot::ALL], sprite: false, particle: true),
57 template!(BLOCK_DIR, "cube_column", &[slot::END, slot::SIDE], sprite: false, particle: true),
58 template!(BLOCK_DIR, "cube_bottom_top", &[slot::TOP, slot::BOTTOM, slot::SIDE], sprite: false, particle: true),
59 template!(BLOCK_DIR, "cube", &DIRECTIONS, sprite: false, particle: false),
60 template!(BLOCK_DIR, "orientable", &[slot::FRONT, slot::SIDE, slot::TOP], sprite: false, particle: true),
61 template!(BLOCK_DIR, "cross", &["cross"], sprite: false, particle: true),
62 template!(ITEM_DIR, "generated", SPRITE_SLOTS, sprite: true, particle: true),
63 template!(ITEM_DIR, "handheld", SPRITE_SLOTS, sprite: true, particle: true),
64];
65
66pub fn template(name: &str) -> Option<&'static Template> {
68 TEMPLATES.iter().find(|t| t.name == name)
69}