azalea_protocol/packets/game/
clientbound_update_recipes_packet.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use std::collections::HashMap;

use azalea_buf::McBuf;
use azalea_core::resource_location::ResourceLocation;
use azalea_inventory::ItemSlot;
use azalea_protocol_macros::ClientboundGamePacket;
use azalea_registry::HolderSet;

#[derive(Clone, Debug, PartialEq, McBuf, ClientboundGamePacket)]
pub struct ClientboundUpdateRecipesPacket {
    pub item_sets: HashMap<ResourceLocation, RecipePropertySet>,
    pub stonecutter_recipes: Vec<SingleInputEntry>,
}

#[derive(Clone, Debug, PartialEq, McBuf)]
pub struct SingleInputEntry {
    pub input: Ingredient,
    pub recipe: SelectableRecipe,
}
#[derive(Clone, Debug, PartialEq, McBuf)]
pub struct SelectableRecipe {
    pub option_display: SlotDisplayData,
}

/// [`azalea_registry::SlotDisplay`]
#[derive(Clone, Debug, PartialEq, McBuf)]
pub enum SlotDisplayData {
    Empty,
    AnyFuel,
    Item(ItemSlotDisplay),
    ItemStack(ItemStackSlotDisplay),
    Tag(ResourceLocation),
    SmithingTrim(Box<SmithingTrimDemoSlotDisplay>),
    WithRemainder(Box<WithRemainderSlotDisplay>),
    Composite(CompositeSlotDisplay),
}

#[derive(Clone, Debug, PartialEq, McBuf)]
pub struct ItemSlotDisplay {
    pub item: azalea_registry::Item,
}
#[derive(Clone, Debug, PartialEq, McBuf)]
pub struct ItemStackSlotDisplay {
    pub stack: ItemSlot,
}
#[derive(Clone, Debug, PartialEq, McBuf)]
pub struct TagSlotDisplay {
    pub tag: azalea_registry::Item,
}
#[derive(Clone, Debug, PartialEq, McBuf)]
pub struct SmithingTrimDemoSlotDisplay {
    pub base: SlotDisplayData,
    pub material: SlotDisplayData,
    pub pattern: SlotDisplayData,
}
#[derive(Clone, Debug, PartialEq, McBuf)]
pub struct WithRemainderSlotDisplay {
    pub input: SlotDisplayData,
    pub remainder: SlotDisplayData,
}
#[derive(Clone, Debug, PartialEq, McBuf)]
pub struct CompositeSlotDisplay {
    pub contents: Vec<SlotDisplayData>,
}

#[derive(Clone, Debug, PartialEq, McBuf)]
pub struct RecipePropertySet {
    pub items: Vec<azalea_registry::Item>,
}

#[derive(Clone, Debug, PartialEq, McBuf)]
pub struct Ingredient {
    pub allowed: HolderSet<azalea_registry::Item, ResourceLocation>,
}