Inventory

Minecraft displays the player inventory differently, according to how the window was opened. Ranges of slot indices vary in meaning between different “windows”. The Open Window packet indicates which window is being opened according to:

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 Window Property packet.

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

Player Inventory


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

Note that this is different from inventory items stored in a player.dat file. This may help: https://gist.github.com/459a1691c3dd751db160

Chest


This is the window that is opened when the player right-clicks on a single chest block.



Large chest
This is the window that is opened when the player right-clicks on a double chest block (two adjacent chest blocks).

Crafting table


This is the window that is opened when the player right-clicks on a workbench.

Furnace


The window that appears when a furnace is right-clicked.

Blast Furnace


The GUI that appears when a blast furnace is opened. Same layout as a furnace; however, the recipe book displays blast furnace recipes instead of regular furnace recipes.

Smoker


The GUI that appears when a smoker is opened. Same layout as a furnace; however, the recipe book displays blast furnace recipes instead of regular furnace recipes.

Dispenser


The inventory that appears when a dispenser or dropper is opened.

Enchantment Table


The inventory of an enchantment table. The enchant buttons trigger a Enchant item packet.

Brewing stand


The GUI that appears when a brewing stand is opened.

Villager trading


The GUI that appears when a villager is right-clicked. Note that if the villager only requires one item, you can put it in either (or both) slots.

Beacon


The window that appears when a beacon is right-clicked.

Hopper


The window that appears when a hopper or hopper minecart is opened.

Shulker box


This is the window that is opened when the player right-clicks on a shulker box chest.

Llama


The inventory that appears when a tamed llama is right-clicked and has a chest, or when the player's inventory is opened 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).

Horse


The window for when a tamed horse is right-clicked or the player's inventory is opened while riding a horse.

Donkey


The inventory that appears when a tamed donkey (or mule?) is right-clicked, or when the player's inventory is opened while riding a tamed donkey or mule.

Cartography Table


The GUI that appears when a cartography table is opened.

Lectern


This is a regular container, unlike with held books opened via Protocol.