pub enum InventoryType {
Show 25 variants
Generic9x1,
Generic9x2,
Generic9x3,
Generic9x4,
Generic9x5,
Generic9x6,
Generic3x3,
Crafter3x3,
Anvil,
Beacon,
BlastFurnace,
BrewingStand,
Crafting,
Enchantment,
Furnace,
Grindstone,
Hopper,
Lectern,
Loom,
Merchant,
ShulkerBox,
Smithing,
Smoker,
Cartography,
Stonecutter,
}Expand description
Type of inventory window in Minecraft 1.21.4.
Each variant maps to a specific Minecraft protocol ID and has a known slot count. Used when opening custom containers for players.
Variants§
Generic9x1
9x1 chest-like inventory (9 slots).
Generic9x2
9x2 chest-like inventory (18 slots).
Generic9x3
9x3 chest-like inventory (27 slots) – single chest.
Generic9x4
9x4 chest-like inventory (36 slots).
Generic9x5
9x5 chest-like inventory (45 slots).
Generic9x6
9x6 chest-like inventory (54 slots) – double chest.
Generic3x3
3x3 dispenser/dropper (9 slots).
Crafter3x3
3x3 crafter (9 slots).
Anvil
Anvil (3 slots).
Beacon
Beacon (1 slot).
BlastFurnace
Blast furnace (3 slots).
BrewingStand
Brewing stand (5 slots).
Crafting
Crafting table (10 slots: 1 output + 3x3 grid).
Enchantment
Enchantment table (2 slots).
Furnace
Furnace (3 slots).
Grindstone
Grindstone (3 slots).
Hopper
Hopper (5 slots).
Lectern
Lectern (1 slot).
Loom
Loom (4 slots).
Merchant
Merchant/villager trade (3 slots).
ShulkerBox
Shulker box (27 slots).
Smithing
Smithing table (4 slots).
Smoker
Smoker (3 slots).
Cartography
Cartography table (3 slots).
Stonecutter
Stonecutter (2 slots).
Implementations§
Source§impl InventoryType
impl InventoryType
Sourcepub fn protocol_id(&self) -> i32
pub fn protocol_id(&self) -> i32
Returns the Minecraft protocol VarInt ID for this inventory type.
Used when encoding the OpenWindow packet. IDs correspond to the
1.21.4 protocol (0 = generic_9x1 through 24 = stonecutter).
Sourcepub fn slot_count(&self) -> usize
pub fn slot_count(&self) -> usize
Returns the number of container slots this type has.
Does not include the player inventory slots that are appended when the window is opened.
Sourcepub fn is_chest_like(&self) -> bool
pub fn is_chest_like(&self) -> bool
Returns true if this is a generic chest-like inventory (9xN) or a shulker box.
Chest-like inventories have simple slot layouts where every slot behaves the same (no special output slot, no fuel/product slots).
Sourcepub fn has_craft_output(&self) -> bool
pub fn has_craft_output(&self) -> bool
Returns true if this inventory has a special crafting output slot at index 0.
Currently only Crafting returns true. The output slot is
server-computed from the crafting grid contents.
Trait Implementations§
Source§impl Clone for InventoryType
impl Clone for InventoryType
Source§fn clone(&self) -> InventoryType
fn clone(&self) -> InventoryType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InventoryType
impl Debug for InventoryType
Source§impl PartialEq for InventoryType
impl PartialEq for InventoryType
impl Copy for InventoryType
impl Eq for InventoryType
impl StructuralPartialEq for InventoryType
Auto Trait Implementations§
impl Freeze for InventoryType
impl RefUnwindSafe for InventoryType
impl Send for InventoryType
impl Sync for InventoryType
impl Unpin for InventoryType
impl UnsafeUnpin for InventoryType
impl UnwindSafe for InventoryType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.