Inventory

From wiki.vg
Revision as of 04:02, 2 October 2014 by ZephireNZ (talk | contribs) (Update Enchantment Table entry)
Jump to navigation Jump to search

Windows

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

Inventory Type Description Technical Name
0 Chest/Large chest minecraft:chest
1 Workbench minecraft:crafting_table
2 Furnace minecraft:furnace
3 Dispenser minecraft:dispenser
4 Enchantment table minecraft:enchanting_table
5 Brewing Stand minecraft:brewing_stand
6 Npc trade minecraft:villager
7 Beacon minecraft:beacon
8 Anvil minecraft:anvil
9 Hopper minecraft:hopper
10 Dropper minecraft:dropper
11 Horse EntityHorse

The slot number is calculated starting at 0, counting up through the window's unique slots, and then counting through the players inventory. The number of unique slots in the window is in the Open Window message for all window types except the default inventory window, in which the number of unique slots is 9. This means the slot in the upper-left corner of the player's inventory is slot n where n is the number of unique slots. Slot number -999 is for clicking outside the window.

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 Beta protocol.

Inventory

Inventory slots

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

Slot range Description
0 crafting output
1-4 (2x2) crafting input (1 + x + 2 * y)
5-8 armor (head, chest, legs, feet)
9-35 main inventory
36-44 held items

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

Crafting window

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

Slot range Description
0 crafting output
1-9 (3x3) crafting input (1 + x + 3 * y)
10-36 main inventory
37-45 held items

Chest

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

Slot range Description
0-26 chest
27-53 main inventory
54-62 held items

Large chest

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

Slot range Description
0-53 chest
54-80 main inventory
81-89 held items

Furnace

Slot range Description
0 above flame
1 fuel
2 output
3-29 main inventory
30-38 held items

Dispenser

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

Slot range Description
0-8 3x3 dispenser contents (x + 3 * y)
9-35 main inventory
36-44 held items

Enchantment Table

Slot range Description
0 enchantment slot
1 lapis slot
2-28 main inventory
29-37 held items