diff --git a/protocol/src/item.rs b/protocol/src/item.rs index 8851dd5..050d7a8 100644 --- a/protocol/src/item.rs +++ b/protocol/src/item.rs @@ -116,3 +116,4 @@ impl Serializable for Option { Result::Ok(()) } } + diff --git a/protocol/src/protocol/packet.rs b/protocol/src/protocol/packet.rs index 24a24e9..9d41ac4 100644 --- a/protocol/src/protocol/packet.rs +++ b/protocol/src/protocol/packet.rs @@ -146,6 +146,15 @@ state_packets!( field button: u8 =, } /// ClickWindow is sent when the client clicks in a window. + packet ClickWindow_State { + field id: u8 =, + field slot: i16 =, + field state: VarInt =, + field button: u8 =, + field mode: VarInt =, + field slots: LenPrefixed =, + field clicked_item: Option =, + } packet ClickWindow { field id: u8 =, field slot: i16 =, @@ -3467,3 +3476,24 @@ impl Serializable for CommandNode { unimplemented!() } } + +#[derive(Debug, Clone, Default)] +pub struct NumberedSlot { + pub slot_number: i16, + pub slot_data: Option, +} + +impl Serializable for NumberedSlot { + fn read_from(buf: &mut R) -> Result { + Ok(NumberedSlot { + slot_number: Serializable::read_from(buf)?, + slot_data: Serializable::read_from(buf)?, + }) + } + + fn write_to(&self, buf: &mut W) -> Result<(), Error> { + self.slot_number.write_to(buf)?; + self.slot_data.write_to(buf) + } +} + diff --git a/protocol/src/protocol/versions/v1_17_1.rs b/protocol/src/protocol/versions/v1_17_1.rs index c8cf2a0..ba45138 100644 --- a/protocol/src/protocol/versions/v1_17_1.rs +++ b/protocol/src/protocol/versions/v1_17_1.rs @@ -16,7 +16,7 @@ protocol_packet_ids!( 0x05 => ClientSettings_Filtering 0x06 => TabComplete 0x07 => ClickWindowButton - 0x08 => ClickWindow + 0x08 => ClickWindow_State 0x09 => CloseWindow 0x0a => PluginMessageServerbound 0x0b => EditBook