chunkedge_protocol/packets/play/
recipe_book_add_s2c.rs1use chunkedge_binary::{Decode, Encode, IDSet, VarInt};
2use chunkedge_generated::registry_id::RegistryId;
3
4use crate::packets::play::update_recipes_s2c::SlotDisplay;
5use crate::Packet;
6
7#[derive(Clone, Debug, Encode, Decode, Packet)]
8pub struct RecipeBookAddS2c<'a> {
9 pub recipes: Vec<RecipeEntry<'a>>,
10 pub replace: bool,
11}
12
13#[derive(Clone, Debug, Encode, Decode)]
14pub struct RecipeEntry<'a> {
15 pub id: VarInt,
16 pub display: RecipeDisplay<'a>,
17 pub group: RegistryId,
18 pub category: RegistryId,
19 pub ingredients: Option<Vec<IDSet>>,
20 pub flags: u8,
22}
23
24#[derive(Clone, Debug, Encode, Decode)]
25pub struct RecipeDisplay<'a> {
26 pub kind: RecipeDisplayKind<'a>,
27}
28
29#[derive(Clone, Debug, Encode, Decode)]
30pub enum RecipeDisplayKind<'a> {
31 CraftingShapeless {
32 ingredients: Vec<SlotDisplay<'a>>,
33 result: SlotDisplay<'a>,
34 crafting_station: SlotDisplay<'a>,
35 },
36 CraftingShaped {
37 width: VarInt,
38 height: VarInt,
39 ingredients: Vec<SlotDisplay<'a>>,
40 result: SlotDisplay<'a>,
41 crafting_station: SlotDisplay<'a>,
42 },
43 Furnace {
44 ingredient: SlotDisplay<'a>,
45 fuel: SlotDisplay<'a>,
46 result: SlotDisplay<'a>,
47 crafting_station: SlotDisplay<'a>,
48 duration: VarInt,
49 experience: f32,
50 },
51 Stonecutter {
52 ingredient: SlotDisplay<'a>,
53 result: SlotDisplay<'a>,
54 crafting_station: SlotDisplay<'a>,
55 },
56 Smithing {
57 template: SlotDisplay<'a>,
58 base: SlotDisplay<'a>,
59 addition: SlotDisplay<'a>,
60 result: SlotDisplay<'a>,
61 crafting_station: SlotDisplay<'a>,
62 },
63}