valence_protocol/packets/play/
click_slot_c2s.rs

1use std::borrow::Cow;
2
3use crate::{Decode, Encode, ItemStack, Packet, VarInt};
4
5#[derive(Clone, Debug, Encode, Decode, Packet)]
6pub struct ClickSlotC2s<'a> {
7    pub window_id: u8,
8    pub state_id: VarInt,
9    pub slot_idx: i16,
10    /// The button used to click the slot. An enum can't easily be used for this
11    /// because the meaning of this value depends on the mode.
12    pub button: i8,
13    pub mode: ClickMode,
14    pub slot_changes: Cow<'a, [SlotChange]>,
15    pub carried_item: ItemStack,
16}
17
18#[derive(Copy, Clone, Debug, PartialEq, Eq, Encode, Decode)]
19pub enum ClickMode {
20    Click,
21    ShiftClick,
22    Hotbar,
23    CreativeMiddleClick,
24    DropKey,
25    Drag,
26    DoubleClick,
27}
28
29#[derive(Clone, Debug, Encode, Decode)]
30pub struct SlotChange {
31    pub idx: i16,
32    pub stack: ItemStack,
33}