Skip to content
WikilyWIKILY
All games23 Wikis · pick your game
Commands and cheatsAll commands

Switch game

23 Wikis · pick your game
/loot

Command

/loot

Generates items from a loot table, a mob's drops, a block's drops or a fishing catch and puts them in a player's inventory, a container, an entity's slots or on the ground.

Syntax

/loot (give <players>|insert <targetPos>|spawn <targetPos>) fish <loot_table> <pos>
/loot (give <players>|insert <targetPos>|spawn <targetPos>) fish <loot_table> <pos> (mainhand|offhand)
/loot (give <players>|insert <targetPos>|spawn <targetPos>) fish <loot_table> <pos> <tool>
/loot (give <players>|insert <targetPos>|spawn <targetPos>) (kill <target>|loot <loot_table>)
/loot (give <players>|insert <targetPos>|spawn <targetPos>) mine <pos>
/loot (give <players>|insert <targetPos>|spawn <targetPos>) mine <pos> (mainhand|offhand)
/loot (give <players>|insert <targetPos>|spawn <targetPos>) mine <pos> <tool>
/loot replace (block <targetPos>|entity <entities>) <slot> <count> fish <loot_table> <pos>
/loot replace (block <targetPos>|entity <entities>) <slot> <count> fish <loot_table> <pos> (mainhand|offhand)
/loot replace (block <targetPos>|entity <entities>) <slot> <count> fish <loot_table> <pos> <tool>
/loot replace (block <targetPos>|entity <entities>) <slot> <count> (kill <target>|loot <loot_table>)
/loot replace (block <targetPos>|entity <entities>) <slot> <count> mine <pos>
/loot replace (block <targetPos>|entity <entities>) <slot> <count> mine <pos> (mainhand|offhand)
/loot replace (block <targetPos>|entity <entities>) <slot> <count> mine <pos> <tool>
/loot replace (block <targetPos>|entity <entities>) <slot> fish <loot_table> <pos>
/loot replace (block <targetPos>|entity <entities>) <slot> fish <loot_table> <pos> (mainhand|offhand)
/loot replace (block <targetPos>|entity <entities>) <slot> fish <loot_table> <pos> <tool>
/loot replace (block <targetPos>|entity <entities>) <slot> (kill <target>|loot <loot_table>)
/loot replace (block <targetPos>|entity <entities>) <slot> mine <pos>
/loot replace (block <targetPos>|entity <entities>) <slot> mine <pos> (mainhand|offhand)
/loot replace (block <targetPos>|entity <entities>) <slot> mine <pos> <tool>

Arguments

ArgumentKind of valueWhat to type
<players>Target selectorFor give: the players who receive the items. One or more players.
<loot_table>Loot tableFor loot and fish: the loot table to roll, as an id such as minecraft:chests/simple_dungeon or as an inline loot table definition.
<pos>Block positionFor mine: the block whose drops are generated. For fish: the position where the fishing takes place.
<tool>ItemFor mine and fish: the item used as the tool, for example minecraft:diamond_pickaxe. The literals mainhand and offhand can be used instead.
<target>Target selectorFor kill: the single entity whose drops are generated. One entity only.
<targetPos>Block positionFor insert and replace block: the position of the container. For spawn: the exact coordinates where the items are dropped.
<slot>Item slotFor replace: the first slot to fill, for example container.0 to container.53, hotbar.0 to hotbar.8, inventory.0 to inventory.26, weapon.mainhand, weapon.offhand, armor.head, armor.chest, armor.legs, armor.feet.
<count>Whole numberFor replace: how many slots to write, 0 or more. Left out, it equals the number of generated stacks. At least 0.
<entities>Target selectorFor replace entity: the entities whose slots are filled. One or more entities.

Details

Permission level2: operators, worlds with cheats on, command blocks and functions
Works inSingleplayer with cheats enabled, operators on multiplayer servers, command blocks and functions.
ResultReports "Dropped <count> <item>" when one item stack was delivered, otherwise "Dropped <number> items"; the kill and mine sources also name the loot table that was used. The number /execute store saves is the number of item stacks that were delivered (0 if nothing was generated or nothing fit).
StructureThe command is always a target followed by a source: first where the items go (give, insert, spawn, replace block, replace entity), then where they come from (loot, kill, mine, fish).
Target: giveAdds every generated stack to the inventory of each chosen player. Items that do not fit are not dropped on the ground.
Target: insertDistributes the items into the container at the position, filling empty slots and topping up matching stacks. Fails with "Target position is not a container" if the block has no inventory.
Target: spawnDrops the items as item entities at the position, with the normal pickup delay.
Target: replaceWrites the items into consecutive slots of a container block or of one or more entities, starting at the given slot. Without a count, as many slots are written as stacks were generated. With a count, exactly that many slots are written, and slots beyond the generated loot are emptied.
Source: lootRolls the given loot table the way a chest would, at the position the command runs from.
Source: killGenerates what the chosen entity would drop if killed, without harming it. Whoever runs the command counts as the killer, so a player running it gets player-kill drops. Fails if the entity has no loot table.
Source: mineGenerates what the block at the position would drop if mined, without breaking it. With no tool it is mined bare-handed; mainhand and offhand use the item held by whoever runs the command; an item id uses that item as the tool. Fails if the block has no loot table.
Source: fishRolls a loot table as a fishing catch at the given position, optionally with a tool (an item id, mainhand or offhand).
Hand itemsmainhand and offhand only work when the command is run by a living entity; otherwise it fails with "Entity can't hold any items".
Loaded positionsEvery block position used must be in a loaded part of the world, or the command fails with "That position is not loaded".

Examples

/loot give @s loot minecraft:chests/simple_dungeon

Rolls the dungeon chest loot table and puts the items in your inventory.

/loot spawn ~ ~1 ~ kill @e[type=minecraft:zombie,limit=1,sort=nearest]

Drops the loot of the nearest Zombie one block above you without killing it.

/loot give @p mine ~ ~-1 ~ mainhand

Gives the nearest player what the block below would drop when mined with the item in your main hand.

/loot insert ~ ~-1 ~ loot minecraft:chests/desert_pyramid

Fills the container below you with Desert Pyramid chest loot.

/loot replace block ~ ~-1 ~ container.0 27 loot minecraft:chests/end_city_treasure

Overwrites the 27 slots of the chest below you with End City treasure, emptying the slots that get no item.

/loot replace entity @s hotbar.0 9 fish minecraft:gameplay/fishing ~ ~ ~ minecraft:fishing_rod

Replaces your hotbar with a fishing catch made with a Fishing Rod at your position.

Join the creator communityThe people who build the Minecraft Java Edition wiki are on our Discord. Ask questions or suggest pages.Join Discord (opens Discord in a new tab)