How to use /loot to give items from a loot table
The /loot command in Minecraft is a versatile tool for manipulating items based on predefined loot tables. It provides significant control over item generation and distribution, making it invaluable for map creators, server administrators, and players seeking to customize their gameplay experience. Understanding this command is key to creating custom challenges, unique rewards, or advanced in-game mechanics.
![]()
Understanding the /loot Command and Loot Tables
At its core, the /loot command interacts with Minecraft’s extensive loot table system. Loot tables are JSON files that define item drops, their quantities, probabilities, and specific conditions (e.g., killed by player, mined with a specific tool). They are structured with “pools” containing “entries,” which can have their own “conditions” and “functions” to modify item behavior.
Vanilla Minecraft contains thousands of pre-existing loot tables for blocks, entities, chest contents in structures, and various gameplay events. The /loot command offers several subcommands to handle these generated items:
-
give: Delivers items from a specified loot table directly into a player’s inventory. This is the primary focus of this guide. -
spawn: Drops items from a loot table into the game world at a given position as physical item entities. -
replace: Places items from a loot table into specific slots of an entity’s inventory (e.g., equipment) or a block’s inventory (e.g., chest slot). -
insert: Adds items from a loot table into a block’s inventory, effectively filling containers like chests.
Step-by-Step Guide: Using /loot with the ‘give’ Subcommand
The give subcommand is widely used for directly providing items to players. Here’s how to use it effectively.
1. Identify the Target Player(s)
Specify which player(s) will receive the items using standard target selectors:
-
@p: Nearest player. -
@a: All players. -
@s: Yourself (the command executor). -
A specific player’s name (e.g.,
Steve).
2. Choose the Loot Table Source
Determine where the loot will originate from. There are three primary options:
-
loot: Directly specifies a path to a loot table (e.g.,namespace:loot_table_path). -
kill: Simulates killing a specified entity, generating its drops according to its loot table. -
mine [tool]: Simulates mining a block at specific coordinates. An optionaltool(e.g.,mainhand) can influence drops, like Silk Touch or Fortune.
3. Construct the Command
Combine the target, the give subcommand, and your chosen loot source into a complete command.
-
Basic
givefrom a direct loot table path:Syntax:
/loot give loot :Example: To give the nearest player items from an End City treasure chest:
/loot give @p loot chests/end_city_treasure
This command uses the vanilla loot tableminecraft:loot_tables/chests/end_city_treasure.jsonto populate the player’s inventory. -
givefrom simulating killing an entity:Syntax:
/loot give killExample: To give the nearest player the drops of the nearest pig:
/loot give @p kill @e[type=pig,limit=1,sort=nearest]
This simulates the pig’s death, transferring its usual drops (like raw porkchop) to the player. -
givefrom simulating mining a block:Syntax:
/loot give mine [tool]Example: To give the player loot from the block below them, as if mined with their main hand item:
/loot give @p mine ~ ~-1 ~ mainhand
The~ ~-1 ~specifies relative coordinates, andmainhandaccounts for tool effects.
4. Execute the Command
Type the constructed command into the chat (with operator permissions) and press Enter, or use it within a command block.
Important Tips for Leveraging /loot
The /loot command, especially with custom resources, unlocks extensive possibilities:
- Custom Content: Loot tables are powerful for creating unique mob drops, custom chest contents, and randomized rewards in adventure maps and mini-games, enhancing player engagement.
-
Data Packs: Define custom loot tables in JSON files within a data pack’s
data//loot_tables/directory. Reference them using/loot give @p loot :. - Online Generators: Use online loot table generators to simplify the creation of complex JSON structures for custom drops, conditions, and functions.
-
Behavior Packs: Integrate
/lootcommands with custom behavior packs to trigger specific loot generation based on custom entities or events. -
Condition Adherence: When using
killormine, the command respects the loot table’s inherent conditions. For example, Silk Touch requirements or “killed by player” conditions are simulated and accounted for.
Common Mistakes to Avoid with /loot
Awareness of common pitfalls can significantly reduce troubleshooting time when using the /loot command.
-
Incorrect Loot Table Path: This is a frequent error. The
namespace:loot_table_pathmust be exact, including correct capitalization and underscores. Misspellings or incorrect placement of custom loot tables in a data pack will prevent the command from finding the specified loot, resulting in no items. -
Syntax Errors: The
/lootcommand can be complex. Double-check syntax, especially with multiple arguments and target selectors. A missing space or incorrect argument order can lead to command failure. -
Loot Table Conditions Not Met: Loot tables often have specific conditions for items to drop. For instance, a spider might only drop spider eyes if “killed by player.” While
/loot killsimulates a player kill, other specific conditions within a loot table might not be met by the command’s context, preventing certain items from appearing. - Empty Output: If a loot table is poorly defined or incorrectly referenced, the command might run without error but yield no items. This indicates an issue with the loot table itself or how it’s being called. Always test custom loot tables thoroughly.
-
Forgetting the
lootKeyword: When directly specifying a loot table path, remember to include thelootkeyword after the subcommand (e.g.,/loot give @p loot chests/end_city_treasure). Omitting it will result in a syntax error.