Slot

This article needs to be updated.
 
Please update this page to reflect recent updates or newly available information.
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),
  • Head armor slot: 103
  • Chest armor slot: 102
  • Leg armor slot: 101
  • Feet armor slot: 100
  • Mainhand: 98
  • Offhand: 99
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.*: contains container.0 to container.53.
  • hotbar.*: contains hotbar.0 to hotbar.8.
  • inventory.*: contains inventory.0 to inventory.26.
  • enderchest.*: contains enderchest.0 to enderchest.26.
  • villager.*: contains villager.0 to villager.7.
  • horse.*: contains horse.0 to horse.14.
  • weapon.*: contains weapon.mainhand, and weapon.offhand.
  • armor.*: contains armor.head, armor.chest, armor.legs, armor.feet, and armor.body.
  • player.crafting.*: contains player.crafting.0 to player.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.mainhand any number (0 in hasitem selector) Mobs only (including armor stands and players) (although not all mobs show or make use of the items)

Wolf uses slot.armor.chest slot for wolf armor.

slot.weapon.offhand any number (0 in hasitem selector)
slot.armor.head any number (0 in hasitem selector)
slot.armor.chest any number (0 in hasitem selector)
slot.armor.legs any number (0 in hasitem selector)
slot.armor.feet any number (0 in hasitem selector)
slot.hotbar 0–8 Players only
slot.inventory 0–the size of the inventory minus 1 Entities with minecraft:inventory component only
slot.enderchest 0–26 Players only
slot.saddle any number (0 in hasitem selector) Horses, donkeys, mules, only; item in it must be a saddle
slot.armor any number (0 in hasitem selector) Horses only; item in it must be a horse armor
slot.chest 0–the size of the chest minus 1 Chested donkeys, mules and llamas only

There's a bug in /replaceitem and /loot. The slot numbers for the two commands are -1–the size of the chest minus 2

slot.equippable 0–the number of equippable slots minus 1 Entities with minecraft:equippable component only. Note that these slots refer to slots in minecraft:inventory component.

Unsupported in /replaceitem and /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 allay 1 1 1, unused No No No No No No
Boat with Chest boat_chest 27 No No No No No No No No
Camel 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 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 drowned No 1 1 No No No No No No
Fox fox No 1 1, unused No No No No No No
Horse 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 husk No 1 1 No No No No No No
Llama 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
Minecart with Chest chest_minecart 27 No No No No No No No No
Minecart with Hopper hopper_minecart 5 No No No No No No No No
Mule 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 panda 1 1 1, unused No No No No No No
Piglin piglin 8 1 1 No No No No No No
Piglin Brute piglin_brute No 1 1 No No No No No No
Player player 27 1 from slot.hotbar 1 No No No No 27 9
Skeleton skeleton No 1 1 No No No No No No
Stray stray No 1 1 No No No No No No
Villager villager 8 1 1, unused No No No No No No
Zombie zombie No 1 1 No No No No No No
Zombie Villager zombie_villager No 1 1 No No No No No No

History

This section is missing information about: Did pigs and striders ever gain a saddle slot, or happy ghasts a harness slot?.
 
Please expand the section to include this information. Further details may exist on the talk page.
Java Edition
1.20.524w05aReplaced horse.armor (401) slot argument with armor.body (105), applicable now to all mobs.
24w10aAdded item_slots argument type for wildcarded slot name.
Added player.cursor and player.crafting.<slot_number> slot name.
24w11aAdded contents slot name for single-slot containers like items and item frames.
pre1Fixed contents slot not working for shot arrows, tridents, spectral arrows, fireballs, and small fireballs.[4]
Bedrock Edition
1.21.20Preview 1.21.10.20Added slot.armor.body slot name.

See also

References

  1. 24w10a — Note: this information is not available in creative mode
  2. a b There's a bug in /replaceitem and /loot. The slot numbers of slot.chest for the two commands are -1–13, refering to slot 0–14 in slot.inventory
  3. There's a bug in /replaceitem and /loot. The slot numbers of slot.chest for the two commands are -1–(N-2), refering to slot 0–(N-1) in slot.inventory
  4. MC-270119 — resolved as "fixed".

Navigation