Difference between revisions of "Inventory"
(updated for offhand slot) |
(fixed window types; clarification) |
||
Line 1: | Line 1: | ||
− | Minecraft displays the '''player inventory''' differently, according to how the window was opened. Ranges of slot indices vary in meaning between different “windows”. | + | Minecraft displays the '''player inventory''' differently, according to how the window was opened. Ranges of slot indices vary in meaning between different “windows”. The [[Protocol#Open Inventory|Open Inventory]] packet indicates which window is being opened according to: |
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
− | ! | + | ! Window Type |
! Description | ! Description | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | minecraft:chest |
| {{Minecraft Wiki|Chest}}, large chest, or {{Minecraft Wiki|minecart with chest}} | | {{Minecraft Wiki|Chest}}, large chest, or {{Minecraft Wiki|minecart with chest}} | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | minecraft:crafting_table |
| {{Minecraft Wiki|Crafting table}} | | {{Minecraft Wiki|Crafting table}} | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | minecraft:furnace |
| {{Minecraft Wiki|Furnace}} | | {{Minecraft Wiki|Furnace}} | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | minecraft:dispenser |
| {{Minecraft Wiki|Dispenser}} | | {{Minecraft Wiki|Dispenser}} | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | minecraft:enchanting_table |
| {{Minecraft Wiki|Enchantment table}} | | {{Minecraft Wiki|Enchantment table}} | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | minecraft:brewing_stand |
| {{Minecraft Wiki|Brewing stand}} | | {{Minecraft Wiki|Brewing stand}} | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | minecraft:villager |
| {{Minecraft Wiki|Villager}} | | {{Minecraft Wiki|Villager}} | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | minecraft:beacon |
| {{Minecraft Wiki|Beacon}} | | {{Minecraft Wiki|Beacon}} | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | minecraft:anvil |
| {{Minecraft Wiki|Anvil}} | | {{Minecraft Wiki|Anvil}} | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | minecraft:hopper |
| {{Minecraft Wiki|Hopper}} or {{Minecraft Wiki|minecart with hopper}} | | {{Minecraft Wiki|Hopper}} or {{Minecraft Wiki|minecart with hopper}} | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | minecraft:dropper |
| {{Minecraft Wiki|Dropper}} | | {{Minecraft Wiki|Dropper}} | ||
− | |||
− | |||
|- | |- | ||
− | | | + | | EntityHorse |
| {{Minecraft Wiki|Horse|Horse, donkey, or mule}} | | {{Minecraft Wiki|Horse|Horse, donkey, or mule}} | ||
− | |||
− | |||
|} | |} | ||
Revision as of 02:26, 5 September 2015
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 Inventory packet indicates which window is being opened according to:
Window Type | Description |
---|---|
minecraft:chest | Chest, large chest, or minecart with chest |
minecraft:crafting_table | Crafting table |
minecraft:furnace | Furnace |
minecraft:dispenser | Dispenser |
minecraft:enchanting_table | Enchantment table |
minecraft:brewing_stand | Brewing stand |
minecraft:villager | Villager |
minecraft:beacon | Beacon |
minecraft:anvil | Anvil |
minecraft:hopper | Hopper or minecart with hopper |
minecraft:dropper | Dropper |
EntityHorse | Horse, donkey, or mule |
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 (Play, 0x2d, clientbound) packet for all window types except the default inventory window, in which the number of unique slots is 9 (10 in the 1.9 snapshots). 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 used 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 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.
Contents
Inventory
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.
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 |
Note that this is different from inventory items stored in a player.dat file. This may help: https://gist.github.com/459a1691c3dd751db160
Crafting table
This is the window that is opened when the player right-clicks on a workbench.
Slot range | Description |
---|---|
0 | crafting output |
1–9 | 3×3 crafting input (1 + x + 3 * y) |
10–36 | main inventory |
37–45 | hotbar |
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 | hotbar |
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 | hotbar |
Furnace
Slot range | Description |
---|---|
0 | ingredient |
1 | fuel |
2 | output |
3–29 | main inventory |
30–38 | hotbar |
Dispenser
Slot range | Description |
---|---|
0–8 | 3×3 dispenser contents (x + 3 * y) |
9–35 | main inventory |
36-44 | hotbar |
Enchantment Table
Slot range | Description |
---|---|
0 | item to enchant |
1 | lapis lazuli slot |
2–28 | main inventory |
29–37 | hotbar |