Slot
Reason: A lot has changed with slots since this page was actually majorly updated, example: the offhand slot for players is no longer the -106th slot of the inventory, it's now located in the "equipment.offhand" NBT tag, and the page also contains a lot of incorrect info in general.
A slot is a location in the data of a block entity or entity that an item stack can be placed in.
Java Edition
A slot is defined by its slot index.
| Slot index | Used by | Description |
|---|---|---|
| -106 | Players | Player offhand slot. Used in NBT tags. |
| 0-53 | General inventories | Different containers have different ranges for the slot number:
|
| 98-103 | Mobs, players, and armor stands (all living entities support these slots although not all mobs show or make use of the items), |
|
| 105 | Mobs, players, and armor stands (all living entities support these slots although not all mobs show or make use of the items) | Slot for horse armor on horse, carpet on llama, wolf armor on wolf |
| 200-226 | Players | Slots in ender chest |
| 300-307 | Villagers, wandering traders, pillagers | Their inventory |
| 400 | Horses, donkeys, mules, llamas | Slot for saddle item |
| 499 | Chested donkeys, llamas, mules | Slot for the chest item of Donkeys, llamas, mules. |
| 499 | Players | Slot for the item held by a player in GUI screens. Not available in creative mode.[1] |
| 500-503 | Players | Crafting slots in inventory screen |
| 500-514 | Chested donkeys, llamas, mules | Slots in their chests. |
Command argument
In commands, a slot should be referred by a string name instead of its index. The string name is mapped to its index when executing command.
A string name of slot consists of slot type and optional slot number, in the format of <slot_type> or <slot_type>.<slot_number>.
| Slot string name | Valid slot number | Mapped index |
|---|---|---|
contents
|
0 | |
container.<slot_number>
|
0-53 | 0-53 |
hotbar.<slot_number>
|
0-8 | 0-8 |
inventory.<slot_number>
|
0-26 | 9-35 |
enderchest.<slot_number>
|
0-26 | 200-226 |
villager.<slot_number>
|
0-7 | 300-307 |
horse.<slot_number>
|
0-14 | 500-514 |
weapon
|
98 | |
weapon.mainhand
|
98 | |
weapon.offhand
|
99 | |
armor.head
|
103 | |
armor.chest
|
102 | |
armor.legs
|
101 | |
armor.feet
|
100 | |
armor.body
|
105 | |
horse.saddle |
400 | |
horse.chest
|
499 | |
player.cursor
|
499 | |
player.crafting.<slot_number>
|
0-3 | 500-503 |
/execute if items command also supports wildcarded slot names:
container.*: containscontainer.0tocontainer.53.hotbar.*: containshotbar.0tohotbar.8.inventory.*: containsinventory.0toinventory.26.enderchest.*: containsenderchest.0toenderchest.26.villager.*: containsvillager.0tovillager.7.horse.*: containshorse.0tohorse.14.weapon.*: containsweapon.mainhand, andweapon.offhand.armor.*: containsarmor.head,armor.chest,armor.legs,armor.feet, andarmor.body.player.crafting.*: containsplayer.crafting.0toplayer.crafting.3.
Bedrock Edition
Command argument
In commands, a slot is referred by two arguments: slot type and slot number.
For a block, its slot type is slot.container.
- Barrels, chests, dispensers, droppers, hoppers, shulker boxs and trapped chests are numbered 0 for the top-left slot and then increase first horizontally, then vertically (so, for example, a chest's top row slots are numbered 0 to 8 from left to right). Double chests and double trapped chests are treated as two single container blocks.
- A brewing stand's bottom slots are numbered 0 to 2 from left to right, its top slot is 3 and the fuel slot is 4.
- A furnace's slots are numbered 0 for the input slot, 1 for the fuel slot, and 2 for the output slot.
For entities:
Slot Type Slot Numbers Restrictions slot.weapon.mainhandany number (0 in hasitemselector)Mobs only (including armor stands and players) (although not all mobs show or make use of the items) Wolf uses
slot.armor.chestslot for wolf armor.slot.weapon.offhandany number (0 in hasitemselector)slot.armor.headany number (0 in hasitemselector)slot.armor.chestany number (0 in hasitemselector)slot.armor.legsany number (0 in hasitemselector)slot.armor.feetany number (0 in hasitemselector)slot.hotbar0–8 Players only slot.inventory0–the size of the inventory minus 1 Entities with minecraft:inventorycomponent onlyslot.enderchest0–26 Players only slot.saddleany number (0 in hasitemselector)Horses, donkeys, mules, only; item in it must be a saddle slot.armorany number (0 in hasitemselector)Horses only; item in it must be a horse armor slot.chest0–the size of the chest minus 1 Chested donkeys, mules and llamas only There's a bug in
/replaceitemand/loot. The slot numbers for the two commands are -1–the size of the chest minus 2slot.equippable0–the number of equippable slots minus 1 Entities with minecraft:equippablecomponent only. Note that these slots refer to slots inminecraft:inventorycomponent.Unsupported in
/replaceitemand/loot
Slots of vanilla entities
| Name | Entity ID | slot .inventory |
slot .weapon .mainhand |
slot .weapon .offhand |
slot .equippable |
slot .armor |
slot .saddle |
slot .chest |
slot .enderchest |
slot .hotbar |
|---|---|---|---|---|---|---|---|---|---|---|
allay
|
1 | 1 | 1, unused | No | No | No | No | No | No | |
boat_chest
|
27 | No | No | No | No | No | No | No | No | |
camel
|
1 | 1, unused | 1, unused | 1 (refers to the slot of slot.saddle) | No | Refers to slot 0 in slot.inventory | No | No | No | |
donkey
|
16 (When tamed) | 1, unused | 1, unused | 1 (refers to the slot of slot.saddle) | No | Refers to slot 0 in slot.inventory (When tamed) | 15 (refers to slot 1–15 in slot.inventory[2]) (When tamed and chested) | No | No | |
drowned
|
No | 1 | 1 | No | No | No | No | No | No | |
fox
|
No | 1 | 1, unused | No | No | No | No | No | No | |
horse
|
2 (When tamed) | 1, unused | 1, unused | 2 (slot 0 refers to slot.saddle, 1 refers to slot.armor) | Refers to slot 1 in slot.inventory (When tamed) | Refers to slot 0 in slot.inventory (When tamed) | No | No | No | |
husk
|
No | 1 | 1 | No | No | No | No | No | No | |
llama
|
16 (When tamed) | 1, unused | 1, unused | 1 (refers to slot 0 in slot.inventory) | No | No | N (refers to slot 1–N in slot.inventory; N is the size of the chest[3])(When tamed and chested) | No | No | |
chest_minecart
|
27 | No | No | No | No | No | No | No | No | |
hopper_minecart
|
5 | No | No | No | No | No | No | No | No | |
mule
|
16 (When tamed) | 1, unused | 1, unused | 1 (refers to the slot of slot.saddle) | No | Refers to slot 0 in slot.inventory (When tamed) | 15 (refers to slot 1–15 in slot.inventory[2]) (When tamed and chested) | No | No | |
panda
|
1 | 1 | 1, unused | No | No | No | No | No | No | |
piglin
|
8 | 1 | 1 | No | No | No | No | No | No | |
piglin_brute
|
No | 1 | 1 | No | No | No | No | No | No | |
player
|
27 | 1 from slot.hotbar | 1 | No | No | No | No | 27 | 9 | |
skeleton
|
No | 1 | 1 | No | No | No | No | No | No | |
stray
|
No | 1 | 1 | No | No | No | No | No | No | |
villager
|
8 | 1 | 1, unused | No | No | No | No | No | No | |
zombie
|
No | 1 | 1 | No | No | No | No | No | No | |
zombie_villager
|
No | 1 | 1 | No | No | No | No | No | No |
History
| Java Edition | |||||||
|---|---|---|---|---|---|---|---|
| 1.20.5 | 24w05a | Replaced horse.armor (401) slot argument with armor.body (105), applicable now to all mobs. | |||||
| 24w10a | Added item_slots argument type for wildcarded slot name.
| ||||||
Added player.cursor and player.crafting.<slot_number> slot name. | |||||||
| 24w11a | Added contents slot name for single-slot containers like items and item frames. | ||||||
| pre1 | Fixed contents slot not working for shot arrows, tridents, spectral arrows, fireballs, and small fireballs.[4] | ||||||
| Bedrock Edition | |||||||
| 1.21.20 | Preview 1.21.10.20 | Added slot.armor.body slot name. | |||||
See also
References
- ↑ 24w10a — Note: this information is not available in creative mode
- ↑ a b There's a bug in
/replaceitemand/loot. The slot numbers ofslot.chestfor the two commands are -1–13, refering to slot 0–14 in slot.inventory - ↑ There's a bug in
/replaceitemand/loot. The slot numbers ofslot.chestfor the two commands are -1–(N-2), refering to slot 0–(N-1) in slot.inventory - ↑ MC-270119 — resolved as "fixed".