Skip to main content

pumpkinplus/modules/recipes/
chainmail.rs

1//! Chainmail armor recipes.
2//!
3//! Provides shaped crafting recipes for chainmail armor pieces using
4//! iron bars as the primary ingredient. Registered via the [`Recipe`] trait.
5//!
6//! ## Recipes
7//!
8//! | Output              | Pattern                | Ingredients |
9//! |---------------------|------------------------|-------------|
10//! | Chainmail Helmet    | `AAA`, `A A`           | `A` = iron bars |
11//! | Chainmail Chestplate| `A A`, `AAA`, `AAA`    | `A` = iron bars |
12//! | Chainmail Leggings  | `AAA`, `A A`, `A A`    | `A` = iron bars |
13//! | Chainmail Boots     | `A A`, `A A`           | `A` = iron bars |
14
15use crate::modules::recipes::recipe::{Ingredient, ItemStack, Recipe, ShapedRecipe};
16
17/// Handles chainmail armor recipe registration.
18#[derive(Default)]
19pub struct Chainmail;
20
21impl Recipe for Chainmail {
22    fn shaped(&self) -> Vec<ShapedRecipe> {
23        vec![
24            // Chainmail Helmet
25            ShapedRecipe {
26                id: "pumpkinplus:chainmail_helmet".into(),
27                height: 2,
28                width: 3,
29                pattern: vec!["AAA".into(), "A A".into()],
30                keys: vec![(
31                    'A',
32                    Ingredient::Item {
33                        id: "minecraft:iron_bars".into(),
34                    },
35                )],
36                result: ItemStack {
37                    id: "minecraft:chainmail_helmet".into(),
38                    count: 1,
39                },
40            },
41            // Chainmail Chestplate
42            ShapedRecipe {
43                id: "pumpkinplus:chainmail_chestplate".into(),
44                height: 3,
45                width: 3,
46                pattern: vec!["A A".into(), "AAA".into(), "AAA".into()],
47                keys: vec![(
48                    'A',
49                    Ingredient::Item {
50                        id: "minecraft:iron_bars".into(),
51                    },
52                )],
53                result: ItemStack {
54                    id: "minecraft:chainmail_chestplate".into(),
55                    count: 1,
56                },
57            },
58            // Chainmail Leggings
59            ShapedRecipe {
60                id: "pumpkinplus:chainmail_leggings".into(),
61                height: 3,
62                width: 3,
63                pattern: vec!["AAA".into(), "A A".into(), "A A".into()],
64                keys: vec![(
65                    'A',
66                    Ingredient::Item {
67                        id: "minecraft:iron_bars".into(),
68                    },
69                )],
70                result: ItemStack {
71                    id: "minecraft:chainmail_leggings".into(),
72                    count: 1,
73                },
74            },
75            // Chainmail Boots
76            ShapedRecipe {
77                id: "pumpkinplus:chainmail_boots".into(),
78                height: 2,
79                width: 3,
80                pattern: vec!["A A".into(), "A A".into()],
81                keys: vec![(
82                    'A',
83                    Ingredient::Item {
84                        id: "minecraft:iron_bars".into(),
85                    },
86                )],
87                result: ItemStack {
88                    id: "minecraft:chainmail_boots".into(),
89                    count: 1,
90                },
91            },
92        ]
93    }
94}