Minecraft Wiki
Advertisement

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

Syntax[]

  • Java Edition
loot <TARGET> <SOURCE>
In which:
<TARGET> is:
give <players>
Gives items to players, ignoring empty item stacks.
insert <targetPos>
Distributes items to a container block.
spawn <targetPos>
Spawns item entities.
replace block <targetPos> <slot> [<count>]
Distributes items to a container block.
replace entity <entities> <slot> [<count>]
Distributes items to entities.
<SOURCE> is:
fish <loot_table> <pos> [<tool>|mainhand|offhand]
loot <loot_table>
kill <target>
mine <pos> [<tool>|mainhand|offhand]
  • Bedrock Edition
loot <TARGET> <SOURCE>
In which:
<TARGET> is:
give <player: target>
Gives items to players, ignoring empty item stacks.
insert <position: x y z>
Distributes items to a container block, ignoring empty item stacks.
spawn <position: x y z>
Spawns item entities, ignoring empty item stacks.
replace block <position: x y z> slot.container <slotId: int> [count: int]
Distributes items to a container block.
replace entity <entity: target> <slotType: EntityEquipmentSlot> <slotId: int> [count: int]
Distributes items to entities.
<SOURCE> is:
kill <entity: target> ["<tool>|mainhand|offhand": string]
loot <loot_table: string> ["<tool>|mainhand|offhand": string]


Arguments[]

JE<loot_table>: resource_location
BE: loot_table: string: basic_string

Specifies which loot table to use.
In Java Edition, must be a resource location which will be resolved during command execution into unregistered content or client-side content.
In Bedrock Edition, must be a string. And it must be a single word that has no space or a quoted string. And it refers to a loot table with the path of "loot_tables/loot_table: string.json".

JE: <tool>: item_stack

Specifies a tool to mine or fish.
It must be in the format of item_id{data_tags}(accepts item and block tags), in which data tags can be omitted when they are not needed.

BE: "<tool>|mainhand|offhand": string: string

Specifies a tool to be used to kill or loot.
Must be a string. And it must be a single word that has no space or a quoted string. Can be mainhand and offhand, otherwise it represents an item id.

JE<target>: entity
BE: entity: target: CommandSelector<Actor> (in kill source)

Specifies one entity to kill simulatively.
Must be a player name, a target selector or a UUID. And the target selector must be in single type.

JE<players>: entity
BE: player: target: CommandSelector<Player>

Specifies one or more players to give.
Must be a player name, a target selector or a UUID[Java Edition only]. And the target selector must‌[JE only]/should‌[BE only] be of player type.

JE: <pos>: block_pos and <targetPos>: block_pos (in replace block and insert mode)
BE: position: x y z: CommandPositionFloat (in replace block and insert mode)

Specifies the position of a block.
In Java Edition: must be a block position composed of <x>, <y> and <z>, each of which must be an integer or a tilde and caret notation.
In Bedrock Edition: must be a three-dimensional coordinates with floating-point number elements. Accepts tilde and caret notations.

JE<targetPos>: block_pos
BE: position: x y z: CommandPositionFloat (in spawn mode)

Specifies the location where item drops.
Must be a three-dimensional coordinates with floating-point number elements. Accepts tilde and caret notations.

JE<entities>: entity
BE: entity: target: CommandSelector<Actor>

Specifies one or more entities to modify.
Must be a player name, a target selector or a UUID[Java Edition only].

JE<count>: integer
BE: count: int: int

Specifies the number of consecutive slots to be filled.
Must be a 32-bit integer number. In Java Edition, it must be between 0 and 2147483647 (inclusive).

JE: <slot>: item_slot
BE: slotType: EntityEquipmentSlot: enum, slot.container, and slotId: int: int

Specifies the inventory slot to be modified.
Must be a string notation that refer to certain slots in the inventory, which consists of "slot type" and optional "slot number", in the format of <slot_type> or <slot_type>.<slot_number> in Java Edition, or <slot_type> <slot_number> in Bedrock Edition. See Slot for details.

Result[]

CommandTriggerJava EditionBedrock Edition
anythe arguments are not specified correctly Unparseable Failed
/... fish ...
/... mine ...
<pos> or position: x y z is unloaded or out of the world Failed
/... mainhand
/... offhand
the executor is not a living entity N/A
the executor is not an entity Failed
/... kill ...<target> or entity: target fails to resolve to a single entity (named player must be online)
the target is not a living entity N/A
the target has no loot table N/A Failed
/... loot ...the loot_table: string is not a valid loot table
/loot replace entity ...<entities> or entity: target fails to resolve to one or more entities (named player must be online) Failed
/loot replace entity ...When one or more item stacks are got, all the targeted entities meet one or more of the following conditions:
  • This entity dosen't have the specified slot.
  • slotId: int(or <slot>) plus count: int(or <cound>) exceeds the size of the greatest valid slot number with the specified slot type this entity has.
Successful
/loot give ...<players> or player: target fails to resolve to one or more online players Failed
/loot insert ...
/loot replace block ...
<targetPos> or position: x y z is unloaded or out of the world
the block at <targetPos> or position: x y z is not a container
/loot replace block ...the block does not have the specified slot
/loot replace block <targetPos> <slot> ...
/loot replace block ... <slotId: int> ...
the number of item stacks got from loot plus the <slot> id is bigger than the number of all slots in the specified container Error Successful
/loot replace block <targetPos> <slot> <count> ...
/loot replace block ... <slotId: int> <count: int> ...
the <count> plus the <slot> id is bigger than the number of all slots in the specified container Failed
anyOtherwiseSuccessful

Output[]

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
anyJava EditionOn fail000
/loot spawn ...On success11the number of item stacks got from loot
/loot give ...On success11the total number of item stacks successfully allocated to each player
/loot insert ...On success11the number of item stacks successfully distributed to the container
/loot replace block ...On success11the number of item stacks successfully distributed to the container
On error0unchangedunchanged
/loot replace entity ...On success11the total number of item stacks successfully allocated to each entity
On error0unchangedunchanged
anyBedrock EditionOn fail0N/AN/A
loot give ...On success[needs testing]N/AN/A
loot spawn ...
loot insert ...
On success1N/AN/A
loot replace entity ...On successWhen zero item stack is got, return 1.

When one or more item stacks are got, return the number of entities that do not meet any of the following conditions:

  • This entity dosen't have the specified slot.
  • slotId: int plus count: int exceeds the size of the greatest valid slot number with the specified slot type this entity has.
N/AN/A

See also[]

  • /give — give specific items to players without specifying a loot table
  • /item[Java Edition only] — modify specific item slots of entities or container
  • /replaceitem[Bedrock Edition only] — modify specific item slots of entities or container

History[]

Java Edition
1.1418w43aAdded /drop.
18w45aRenamed /drop to /loot.
/loot got reworked.
Bedrock Edition
1.18beta 1.18.0.21Added /loot spawn ... loot ....
beta 1.18.0.22Removed /loot.
1.18.10beta 1.18.10.21Re-added /loot.
beta 1.18.10.24Added /loot spawn ... kill ...
1.18.20beta 1.18.20.21Added /loot give ...
1.18.30beta 1.18.30.20Added /loot insert ...
1.19.0beta 1.19.0.30Added /loot replace entity ...
1.19.40beta 1.19.40.20Added /loot replace block ...
Advertisement