Updated:
Basic form
/loot give @p loot minecraft:chests/simple_dungeon
Rolls the dungeon chest loot and gives the result to the nearest player. Each run gives different items.
A /loot command has two parts: where the items go, and what to roll.
Where the items go
| Syntax | Destination |
|---|---|
give @p | The player's inventory |
spawn ~ ~1 ~ | Dropped as items at that position |
insert 10 64 10 | Into the chest or container there |
replace block 10 64 10 container.0 | Replaces a container slot |
replace entity @p hotbar.0 | Replaces a player slot |
What to roll
| Syntax | Result |
|---|---|
loot <table> | Chest, fishing and other loot tables |
kill <entity> | What that mob would drop (it is not killed) |
mine <pos> [tool] | What that block would drop (it is not broken) |
fish <table> <pos> | One catch from fishing at that spot |
Examples
/loot spawn ~ ~1 ~ loot minecraft:chests/end_city_treasure
/loot give @p kill @e[type=minecraft:zombie,limit=1,sort=nearest]
/loot give @p mine ~ ~-1 ~ minecraft:diamond_pickaxe
/loot give @p fish minecraft:gameplay/fishing ~ ~ ~
- Line 1 drops end city treasure in front of you.
- Line 2 gives the drops of the nearest zombie, which stays alive.
- Line 3 gives what the block under you drops when mined with a diamond pickaxe. A tool with Fortune or other enchantments applies them.
- Line 4 gives one fishing catch.
Common loot tables
| ID | Contents |
|---|---|
minecraft:chests/simple_dungeon | Dungeon chest |
minecraft:chests/desert_pyramid | Desert temple |
minecraft:chests/buried_treasure | Buried treasure |
minecraft:chests/bastion_treasure | Bastion treasure room |
minecraft:chests/end_city_treasure | End city |
minecraft:chests/ancient_city | Ancient city |
minecraft:gameplay/fishing | Fishing |
Press Tab while typing to list every ID. To roll the loot when a chest is first opened, place a chest with a LootTable instead.
Build a gacha machine
/loot give @p[scores={coins=10..}] loot minecraft:chests/simple_dungeon
/scoreboard players remove @p[scores={coins=10..}] coins 10
Only players with 10 or more coins get a prize, and they pay 10 coins. Run both lines in order from a button and you have a prize machine. For the coin score, see the scoreboard guide. For your own prize list, make a custom loot table in a data pack.
Bedrock Edition
Bedrock also has /loot, but loot tables are written differently and fewer destinations exist. Follow the suggestions as you type.
Common problems
- Nothing appears: some tables can roll empty. Try a few times.
- insert does nothing: check there is a container at that position with free space.
- Unknown loot table: check the spelling and your version.
Common questions
- give or spawn? give puts items straight into the inventory; spawn looks like items bursting out of a chest.
- Does kill kill the mob? No. It only creates the drops.
- Same items every time? Use /give for fixed items. /loot is for random results.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.