Skip to main content

Click

Enum Click 

Source
#[non_exhaustive]
pub enum Click { Pickup { slot: i16, right: bool, }, QuickMove { slot: i16, right: bool, }, Swap { slot: i16, hotbar: u8, }, Drop { slot: i16, all: bool, }, PickupAll { slot: i16, }, Clone { slot: i16, }, QuickCraft { slot: i16, stage: DragStage, kind: DragKind, }, }
Expand description

A click intent: the vanilla GUI gestures a bot needs. Slot numbers are the open screen’s (window 0 when only the player inventory is open); OUTSIDE (-999) is a click outside the window.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Pickup

Mode 0: left click (right = false: pick up / put down / swap the whole stack) or right click (pick up half / put down one). On OUTSIDE it drops the cursor stack (left) or one item of it (right).

Fields

§slot: i16

Slot, or OUTSIDE.

§right: bool

Right mouse button.

§

QuickMove

Mode 1: shift-click (move the stack to the other part of the window).

Fields

§slot: i16

Slot.

§right: bool

Right mouse button (same effect).

§

Swap

Mode 2: number key over a slot: swap it with hotbar slot hotbar (0..=8), or on 1.16.5 40 (the swap-hands key) with the offhand.

Fields

§slot: i16

Slot.

§hotbar: u8

Hotbar index 0..=8, or 40 (offhand, 1.16.5 only).

§

Drop

Mode 4: drop key over a slot (all = false: one item, Q; all = true: the stack, ctrl+Q). With an empty cursor and OUTSIDE this is what the vanilla GUI sends for a click outside the window (no effect).

Fields

§slot: i16

Slot, or OUTSIDE.

§all: bool

Whole stack.

§

PickupAll

Mode 6: double click: gather items like the cursor stack into it.

Fields

§slot: i16

Slot (normally the now empty slot the stack was picked up from).

§

Clone

Mode 3: middle click in creative mode: a full stack of the slot’s item onto the empty cursor (26.1; no effect outside creative mode).

Fields

§slot: i16

Slot.

§

QuickCraft

Mode 5: one packet of a drag (“quick craft”): the GUI sends DragStage::Start (slot OUTSIDE), one DragStage::Slot per slot the mouse crosses, then DragStage::End (slot OUTSIDE), each its own click (26.1).

Fields

§slot: i16

Slot (OUTSIDE for start and end).

§stage: DragStage

Which packet of the drag.

§kind: DragKind

How the carried stack is spread.

Implementations§

Source§

impl Click

Source

pub fn wire(self) -> (i16, u8, u8)

The wire (slot, button, mode).

Trait Implementations§

Source§

impl Clone for Click

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Click

Source§

impl Debug for Click

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Click

Source§

impl Hash for Click

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Click

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Click

Auto Trait Implementations§

§

impl Forget for Click

§

impl Freeze for Click

§

impl Move for Click

§

impl RefUnwindSafe for Click

§

impl Send for Click

§

impl Sync for Click

§

impl Unpin for Click

§

impl UnsafeUnpin for Click

§

impl UnwindSafe for Click

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.