Java Edition protocol/Inventory

Minecraft displays the player inventory differently, according to how the window was opened. Ranges of slot indices vary in meaning between different “windows”.

Types

Packet Type Name Description
inventory
The player inventory.
Open Horse Screen
horse
A inventory for horses. Used by Horse, Donkey, Mule, Llama, Trader Llama, and Camel.
Open Screen 0 generic_9x1 A 1-row inventory, not used by the notchian server.
1 generic_9x2 A 2-row inventory, not used by the notchian server.
2 generic_9x3 General-purpose 3-row inventory. Used by Chest, Minecart with Chest, Ender Chest, and Barrel.
3 generic_9x4 A 4-row inventory, not used by the notchian server.
4 generic_9x5 A 5-row inventory, not used by the notchian server.
5 generic_9x6 General-purpose 6-row inventory, used by Large Chest.
6 generic_3x3 General-purpose 3-by-3 square inventory, used by Dispenser and Dropper.
7 crafter_3x3 Crafter
8 anvil Anvil
9 beacon Beacon
10 blast_furnace Blast Furnace
11 brewing_stand Brewing Stand
12 crafting Crafting Table
13 enchantment Enchanting Table
14 furnace Furnace
15 grindstone Grindstone
16 hopper Hopper or Minecart with Hopper
17 lectern Lectern
18 loom Loom
19 merchant Villager or Wandering Trader
20 shulker_box Shulker Box
21 smithing Smithing Table
22 smoker Smoker
23 cartography_table Cartography Table
24 stonecutter Stonecutter

The slot number is calculated starting at 0, counting up through the window's unique slots, and then counting through the players inventory.

For all windows, the slot in the upper-left corner of the player's inventory is slot n where n is the number of unique slots, and slot number -999 is always used for clicking outside the window.

The default inventory window, which is never explicitly opened by the server, has 10 unique slots.

Rectangular regions are always indexed starting with the upper-left corner and scanning across rows. If a window has a crafting region, the output slot is always slot 0 followed immediately by the input region.

Each window type is described in the following sections. All slot index ranges are inclusive and reflect the indices observed in the Minecraft protocol.

For the window properties (additional data in each window, e.g. smelting progress or enchantments), refer to the table in the Set Container Property packet.

Using -1 as slot index and as window id will set the cursor item (the stack dragged with the mouse).

Player Inventory

Inventory slots

This is the inventory window that the player can always open, typically by pressing E since Beta 1.4. Before, you had to press I.

The slots differ when storing using the player.dat format.
Slot range Description
0 crafting output
1–4 2×2 crafting input (1 + x + 2 * y)
5–8 armor (head, chest, legs, feet)
9–35 main inventory
36–44 hotbar
45 Offhand slot

Horse

Horse slots

The GUI that appears when interacting with a tamed horse, or when opening the player's inventory while riding a tamed horse.

The horse, donkey and llama technically share the same GUI, but are split into separate entries for clarity.
Slot range Description
0 saddle
1 armor
2–28 main inventory
29–37 hotbar

Donkey

Donkey slots

The GUI that appears when interacting with a tamed donkey or mule, or when opening the player's inventory while riding a tamed donkey or mule.

There still is an armor slot, even though it cannot be used and is invisible.
Slot range Description
0 saddle
1 armor
2–16 donkey inventory
17–43 (2-28 if unchested) player inventory
44–52 (29-37 if unchested) hotbar

Llama

Llama slots

The GUI that appears when interacting with a tamed llama or trader llama that has a chest, or when opening the player's inventory while riding a tamed llama.

Depending on the value of the strength field, the number of chest rows may vary (max is 5, so 15 slots).

There still is a saddle slot, even though it cannot be used and is invisible.
Slot positions within the llama inventory vary - slot 2 may be at (1,0) or at (0,1) depending on the number of columns.
Slot range Description
0 saddle
1 carpet
2 - (2 + 3 * strength) llama inventory
(2 + 3 * strength) + 1 - (2 + 3 * strength) + 27 player inventory
(2 + 3 * strength) + 28 - (2 + 3 * strength) + 35 hotbar

Chest

Chest slots

The generic_9x3 GUI appears when interacting with a single chest, minecart with chest, ender chest, or barrel.

Slot range Description
0–26 chest
27–53 main inventory
54–62 hotbar

Dispenser

Dispenser/dropper slots

The generic_3x3 GUI appears when interacting with a dispenser or dropper.

Slot range Description
0–8 3×3 dispenser contents (x + 3 * y)
9–35 main inventory
36-44 hotbar

Crafter

Crafter slots

The crafter GUI appears when interacting with a crafter.

Disabling slots is implemented by sending a Click Container packet with no carried item to an empty slot.
Slot range Description
0-8 3×3 crafting input (x + 3 * y)
9–35 main inventory
36–44 hotbar
45 result

Anvil

Anvil slots

The anvil GUI appears when interacting with an anvil.

The name input is implemented using the Rename Item packet.
Slot range Description
0 first item
1 second item
2 result
3–29 main inventory
30–38 hotbar

Beacon

Beacon slots

The beacon GUI appears when interacting with a beacon.

The effect buttons are clientside and sent using the Set Beacon Effect packet when clicking the confirm button.
Slot range Description
0 payment item
1–27 main inventory
28–36 hotbar

Furnace

Furnace slots

The furnace GUI appears when interacting with a furnace.

Slot range Description
0 ingredient
1 fuel
2 output
3–29 main inventory
30–38 hotbar

Blast Furnace

Blast furnace slots

The blast_furnace GUI appears when interacting with a blast furnace.

Same layout as a furnace; however, the recipe book displays blast furnace recipes instead of regular furnace recipes.

Slot range Description
0 ingredient
1 fuel
2 output
3–29 main inventory
30–38 hotbar

Smoker

Smoker slots

The smoker GUI appears when interacting with a smoker.

Same layout as a furnace; however, the recipe book displays smoker recipes instead of regular furnace recipes.

Slot range Description
0 ingredient
1 fuel
2 output
3–29 main inventory
30–38 hotbar

Brewing Stand

Brewing stand slots

The brewing_stand GUI appears when interacting with a brewing stand.

Slot range Description
0-2 bottles/potions
3 potion ingredient
4 blaze powder
5-31 main inventory
32-40 hotbar

Crafting

Crafting table slots

The crafting GUI appears when interacting with a crafting table.

Slot range Description
0 crafting output
1–9 3×3 crafting input (1 + x + 3 * y)
10–36 main inventory
37–45 hotbar

Enchantment

Enchanting table slots

The enchantment GUI appears when interacting with an enchanting table.

Slot range Description
0 item to enchant
1 lapis lazuli slot
2–28 main inventory
29–37 hotbar
Button Description
0-2 Enchantment

Grindstone

Grindstone slots

The grindstone GUI appears when interacting with a grindstone.

Slot range Description
0 first item
1 second item
2 result
3–29 main inventory
30–38 hotbar

Hopper

Hopper slots

The hopper GUI appears when interacting with a hopper or minecart with hopper.

Slot range Description
0-4 hopper slots
5–31 main inventory
32–40 hotbar

Lectern

Lectern UI

The lectern GUI appears when interacting with a lectern with a book.

The player inventory is not included.

Slot range Description
0 book
Button Description
0 unused
1 Page back
2 Page forward
3 Take Book
100 + page - 1 Change page (via "change_page" click event)

Loom

Loom slots

The loom GUI appears when interacting with a loom.

The patterns retain their button ID when scrolling, i.e. the first visible button may have an ID higher than zero.
Slot range Description
0 banner
1 dye
2 pattern
3 result
4–30 main inventory
31–39 hotbar
Button Description
n Pattern n

Merchant

Merchant slots

The merchant GUI appears when interacting with a villager or wandering trader.

If the villager only requires one item, you can put it in either (or both) slots.
The trade buttons are implemented using the Select Trade packet.
Slot range Description
0-1 input items
2 result
3–29 main inventory
30–38 hotbar

Shulker Box

Shulker box slots

The shulker_box GUI appears when interacting with a shulker box.

Although the GUI is effectively identical to generic_9x3, it is technically a distinct GUI (with its own texture).
Slot range Description
0–26 box slots
27–53 main inventory
54–62 hotbar

Smithing

Smithing table slots

The smithing GUI appears when interacting with a smithing table.

Slot range Description
0 template
1 base item
2 additional item
3 result
4–30 main inventory
31–39 hotbar

Cartography Table

Cartography table slots

The cartography_table GUI appears when interacting with a cartography table.

Slot range Description
0 map
1 paper
2 output
3–29 main inventory
30–38 hotbar

Stonecutter

Stonecutter slots

The stonecutter GUI appears when interacting with a stonecutter.

The recipes retain their button ID when scrolling, i.e. the first visible button may have an ID higher than zero.
Slot range Description
0 input
1 result
2–28 main inventory
29–37 hotbar
Button Description
n Recipe n
This article is licensed under a Creative Commons Attribution-ShareAlike 3.0 license.
 
This article has been imported from wiki.vg or is a derivative of such a page. Thus, the wiki's usual license does not apply.
Derivative works must be licensed using the same or a compatible license.