Skip to main content

WindowKind

Enum WindowKind 

Source
#[non_exhaustive]
pub enum WindowKind {
Show 19 variants Chest { rows: u8, }, Generic3x3, Hopper, ShulkerBox, Crafting, Furnace, BrewingStand, Enchanting, Anvil, Beacon, Merchant, Horse { slots: u8, }, Grindstone, Lectern, Loom, Smithing, Cartography, Stonecutter, Crafter,
}
Expand description

The vanilla screen handler (container class) the client created for a 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.
§

Chest

Chest-like grid of rows × 9 slots (1.8 minecraft:chest, minecraft:container and unknown types with slots; 1.16.5 generic_9x1 … generic_9x6).

Fields

§rows: u8

Number of rows (1.8: slotCount / 9, may be 0).

§

Generic3x3

Dispenser / dropper (1.16.5 generic_3x3).

§

Hopper

Hopper (5 slots).

§

ShulkerBox

1.12 / 1.16.5 shulker box (27 slots that refuse shulker boxes).

§

Crafting

Crafting table: result slot 0, grid 1..=9.

§

Furnace

Furnace (also 1.16.5 smoker and blast furnace): input 0, fuel 1, output 2.

§

BrewingStand

Brewing stand (1.8: 4 slots; 1.12 / 1.16.5: 5 with the blaze powder slot).

§

Enchanting

Enchanting table (item, lapis).

§

Anvil

Anvil (2 inputs, result).

§

Beacon

Beacon (payment slot).

§

Merchant

Villager trading (2 inputs, result).

§

Horse

Horse / donkey / llama inventory with slots container slots (saddle, armor, chest).

Fields

§slots: u8

Container slots as sent by the server.

§

Grindstone

1.16.5 grindstone.

§

Lectern

1.16.5 lectern (one book slot, no player inventory).

§

Loom

1.16.5 loom.

§

Smithing

1.16.5 smithing table.

§

Cartography

1.16.5 cartography table.

§

Stonecutter

1.16.5 stonecutter.

§

Crafter

26.1 crafter: 9 grid slots, the player inventory, then the result (screen slot 45).

Implementations§

Source§

impl WindowKind

Source

pub fn from_v1_8(inventory_type: &str, slot_count: u8) -> Option<WindowKind>

The window type of a 1.8 open_window (inventoryType, slotCount), as ClientPlayNetworkHandler.onOpenScreen builds it. None: the vanilla client opens no container for it (a slotless type it has no GUI for).

Source

pub fn from_v1_12_2(inventory_type: &str, slot_count: u8) -> Option<WindowKind>

The window type of a 1.12.2 open_window (inventoryType, slotCount): the 1.8 rules plus minecraft:shulker_box.

Source

pub fn from_v1_16_5(menu_type: i32) -> Option<WindowKind>

The window type of a 1.16.5 open_window (menu type registry id).

Source

pub fn container_len(self, version: Version) -> usize

Number of container slots (before the player’s 27 + 9).

Source

pub fn has_player_inventory(self) -> bool

Whether the player’s main inventory and hotbar follow the container slots.

Source

pub fn slot_kind(self, i: usize) -> SlotKind

Kind of container slot i (i < container_len).

Trait Implementations§

Source§

impl Clone for WindowKind

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 WindowKind

Source§

impl Debug for WindowKind

Source§

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

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

impl Eq for WindowKind

Source§

impl Hash for WindowKind

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 WindowKind

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 WindowKind

Auto Trait Implementations§

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.