Commands/loot

From Minecraft Wiki
Jump to: navigation, search
Grass Block.svg
This page contains content on features that may be included in the next update.
These features have appeared in development versions, but the full update containing these features has not been released yet.
This article is a stub.
Please help us by expanding it.
loot
Restrictions

Operator

First introduced

1.14 (18w43a)

Drops the given loot table into the specified inventory or into the world.

Syntax
loot <target> <source>

Targets

spawn <x> <y> <z>
replace entity <entity selector> <slot> [<count>]
replace block <x> <y> <z> <slot> [<count>]
give <player selector>
insert <x> <y> <z>

Sources

fish <loot table id> <fishing location> [tool <item>|mainhand|offhand]
loot <loot table id>
kill <entity selector>
mine <x> <y> <z> [tool <item>|mainhand|offhand]


Arguments
loot table
Specifies which loot table to use.
x y z
Specifies the position of a block or location in the world where the command should be executed. May use tilde notation to specify a position relative to the command's execution.
selector
Specifies one or more entities to modify. Must be a player name or target selector.
slot
Specifies the inventory slot to be modified. Valid values depend on whether a block or an entity is being modified.
For blocks, must be container.slot_number (BE: slot.container <slotId: int>) where slot_number or slotId: int is replaced with a number specifying the slot.
  • Chests, dispensers, droppers, hoppers, 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.
Other blocks which hold items but don't have inventory GUIs (flower pots and jukeboxes) can only be changed with /data.
For entities, must be one of the following, where slot_number is replaced with a number specifying the slot:
Slot Slot Numbers Restrictions
armor.chest armor stands, mobs, and players only (though not all mobs will show or make use of the items)
armor.feet
armor.head
armor.legs
weapon.mainhand
weapon.offhand
container.slot_number[Java Edition only] 0–53 players and minecarts only
enderchest.slot_number
(BE: slot.enderchest <slotId: int>)
0–26 players only
hotbar.slot_number
(BE: slot.hotbar <slotId: int>)
0–8
inventory.slot_number
(BE: slot.inventory <slotId: int>)
0–26
horse.saddle
(BE: slot.saddle <slotId: int>)
horses, donkeys, and mules only; item must be a saddle
horse.chest[Java Edition only] donkeys, and mules only; item must be a chest
horse.armor
(BE: slot.armor)
horses and llamas only; item must be a type of horse armor (if a horse) or a carpet (if a llama)
horse.slot_number
(BE: slot.chest <slotId: int>)
0–14 donkeys and mules with chests only
villager.slot_number[Java Edition only] 0–7 villagers only
The inventory of an item frame can only be changed with /data.
item
Specifies the item. Must be an item id, or a block id for which an item exists (for example, minecraft:golden_sword).
amount
Specifies the number of items. Must be between 1 and 64 (inclusive), even for items with a smaller stack size.
Result
Fails if the arguments are not specified correctly or the specified source entity doesn't have a loot table (for example, players do not have loot tables).
On success, returns if items were dropped onto the ground in the direction specified.
See also

/give — give specific items to players without specifying a loot table