chunkedge_protocol/packets/play/
update_recipes_s2c.rs

1use std::borrow::Cow;
2
3use chunkedge_binary::{Decode, Encode, IDSet, VarInt};
4use chunkedge_generated::registry_id::RegistryId;
5use chunkedge_ident::Ident;
6use chunkedge_item::ItemStack;
7
8use crate::Packet;
9
10#[derive(Clone, Debug, Encode, Decode, Packet)]
11pub struct UpdateRecipesS2c<'a> {
12    pub property_sets: Vec<PropertySet<'a>>,
13    pub stonecutter_recipes: Vec<StonecutterRecipe<'a>>,
14}
15
16#[derive(Clone, Debug, Encode, Decode)]
17pub struct PropertySet<'a> {
18    pub id: Ident<Cow<'a, str>>,
19    pub items: Vec<VarInt>,
20}
21
22#[derive(Clone, Debug, Encode, Decode)]
23pub struct StonecutterRecipe<'a> {
24    pub ingredients: IDSet,
25    pub result: SlotDisplay<'a>,
26}
27
28#[derive(Clone, Debug, Encode, Decode)]
29pub enum SlotDisplay<'a> {
30    Empty,
31    AnyFuel,
32    Item(RegistryId),
33    ItemStack(Box<ItemStack>),
34    Tag(Ident<Cow<'a, str>>),
35    SmithingTrim {
36        base: Box<SlotDisplay<'a>>,
37        material: Box<SlotDisplay<'a>>,
38        pattern: RegistryId, // ID in trim_pattern registry
39    },
40    WithRemainder {
41        ingredient: Box<SlotDisplay<'a>>,
42        remainder: Box<SlotDisplay<'a>>,
43    },
44    Composite(Vec<SlotDisplay<'a>>),
45}