Loot table

Loot tables are technical JSON files that are used to dictate what items should generate in various situations, such as what items should be in naturally generated containers, what items should drop when breaking a block or killing a mob, what items can be fished, and more. It does not affect dropped experience, or dropped non-item entities such as slimes from larger slimes or silverfish from infested blocks.

Usage
The loot tables are structured as a String tag that determines the table to use, and a Long tag determining the seed. Containers or mobs with the same seed and table drop the same items. Loot tables do not determine the container's slot to be used; that is randomly determined based on the seed.

For chests, trapped chests, hoppers, storage minecarts, minecarts with hoppers, dispensers, droppers, and shulker boxes: These tags are removed once the items have been interacted with (by opening the container, breaking the container, etc.), and only then are items put in the container.
 * : Loot table to be used to fill the container when it is next opened, or the items are otherwise interacted with. When the container is a chest that is part of a double chest, only the half corresponding to the tagged single-chest is affected.
 * : Seed for generating the loot table. Works similarly to the seeds for worlds. 0 or omitted uses a random seed.
 * : Seed for generating the loot table. Works similarly to the seeds for worlds. 0 or omitted uses a random seed.

For mobs:


 * The root tag.
 * : Loot table to be used for the items that drop when the entity is killed.
 * : Seed for generating the loot table. Works similarly to the seeds for worlds. 0 or omitted uses a random seed.

The loot tables of mobs and containers can be altered with and. The player could also grant a loot table to an entity or drop it in the world with.

Tags
Loot tables are defined using the JSON format. Below are a list of tags used.


 * Optional type of the loot table. Must be one of  if the loot table does not generate any loot,   for loot an entity drops,   for loot a block drops,   for a treasure chest,   for a fishing loot table,   for a cat or villager gift,   if it's used as a reward for an advancement,   for loot from bartering with piglins or   if none of the above apply.
 * : A list of all pools for this loot table. Each pool used generates items from its list of items based on the number of rolls. Pools are applied in order.
 * A pool.
 * Determines conditions for this pool to be used. If multiple conditions are specified, all must pass.
 * A condition.
 * Namespaced ID of condition. Valid conditions are described below.
 * Applies functions to the item stack being produced.
 * A function.
 * Namespaced ID of the function to apply. Valid functions are described below.
 * Determines conditions for this function to be applied. If multiple conditions are specified, all must pass.
 * A condition.
 * Namespaced ID of condition. Valid conditions are described below.
 * Specifies the exact number of rolls on the pool.
 * Specifies a random number of rolls within a range.
 * : Minimum number of rolls. Inclusive.
 * : Maximum number of rolls. Inclusive.
 * Specifies the exact number of bonus rolls on the pool per point of luck. Rounded down after multiplying.
 * Specifies a random number of bonus rolls within a range. Rounded down after multiplying.
 * : Minimum number of bonus rolls. Inclusive.
 * : Maximum number of bonus rolls. Inclusive.
 * A list of all things that can be produced by this pool. One entry is chosen per roll as a weighted random selection from all entries without failing conditions.
 * An entry.
 * : Determines conditions for this entry to be used. If multiple conditions are specified, all must pass.
 * A condition.
 * : Namespaced ID of condition. Valid conditions are described below.
 * : Namespaced ID type of entry. Can be  for item entries,   for item tags,   to produce items from another loot table,   for child entries,   to select one sub-entry from a list,   to select sub-entries until one entry cannot be granted,   to generate block specific drops, or   for an entry that generates nothing.
 * For type 'item', ID name of the item to be produced, e.g. . The default, if not changed by , is a stack of 1 of the default instance of the item.
 * For type 'tag' item tag to be used, e.g..
 * For type 'loot_table', loot table to be used, e.g..
 * For type 'dynamic', can be  for block entity contents or   for banners and player skulls.
 * For type 'group' a list of entries that are used to generate loot. Can be used for convenience, e.g. if one condition applies for multiple entries.
 * For type 'alternatives' a list of entries of which the first, and only the first, successful entry gets generated.
 * For type 'sequence' a list of entries that are used until the first entry fails. After an entry fails, no more entries of this list are generated
 * : For type 'tag', if set to true, it chooses one item of the tag, each with the same weight and quality. If false, it uses all the items in the tag.
 * : For type 'item', applies functions to the item stack being produced. Functions are applied in order, so for example  must be after   to work correctly.
 * A function.
 * : Namespaced ID of the function to apply. Valid functions are described below.
 * : Determines conditions for this function to be applied. If multiple conditions are specified, all must pass.
 * A condition.
 * : Namespaced ID of condition. Valid conditions are described below.
 * : Determines how often this entry is chosen out of all the entries in the pool. Entries with higher weights are used more often (chance is $this entry's weight/total of all considered entries' weights$).
 * : Modifies the entry's  based on the killing/opening/fishing player's luck attribute. Formula is.
 * : Namespaced ID of condition. Valid conditions are described below.
 * : Determines how often this entry is chosen out of all the entries in the pool. Entries with higher weights are used more often (chance is ⇭⇭⇭).
 * : Modifies the entry's  based on the killing/opening/fishing player's luck attribute. Formula is.

Functions
Loot tables use various functions to change the item stack being produced, such as adjusting the stack size or adding enchantments. Below are a list of valid functions, and the tags used by them. The tags are placed in the same function object as :.


 * apply_bonus - Applies a predefined bonus formula.
 * : Enchantment ID used for level calculation.
 * : Can be  for a binomial distribution (with ,  ),   for uniform distribution (from   to  ), or   for a special function used for ore drops in the vanilla game.
 * : Values required for the formula.
 * : For formula 'binomial_with_bonus_count', the extra value.
 * : For formula 'binomial_with_bonus_count', the probability.
 * : For formula 'uniform_bonus_count', the bonus multiplier.


 * copy_name - For loot table type 'block', copies a block entity's  tag into the item's   tag.
 * - Needs to be set to 'block_entity'.


 * copy_nbt - Copies nbt to the item's  tag.
 * : Specifies the source. Set to  for the block entity of the destroyed block,   to use the entity that died or the player that gained the advancement, opened the container or broke the block,   for the killer, or   for a killer that is a player.
 * : A list of copy operations.
 * An operation
 * : The nbt path to copy from.
 * : The nbt path to copy to, starting from the item's  tag.
 * : Can be  to replace any existing contents of the target,   to append to a list, or   to merge into a compound tag.


 * copy_state - Copies state properties from dropped block to the item's  tag.
 * : A block ID. Function fails if the block doesn't match.
 * : A list of property names to copy.
 * A block state name to copy.


 * enchant_randomly - Enchants the item with one randomly-selected enchantment. The level of the enchantment, if applicable, is random.
 * : List of enchantment IDs to choose from. If omitted, all enchantments applicable to the item are possible.


 * enchant_with_levels - Enchants the item, with the specified enchantment level (roughly equivalent to using an enchantment table at that level).
 * : Determines whether treasure enchantments are allowed on this item.
 * : Specifies the exact enchantment level to use.
 * : Specifies a random enchantment level within a range.
 * : Minimum level to use.
 * : Maximum level to use.


 * exploration_map - Converts an empty map into an explorer map leading to a nearby generated structure.
 * : The type of generated structure to locate. Accepts any of the s used by the  command (case insensitive).
 * : The icon used to mark the destination on the map. Accepts any of the map icon text IDs (case insensitive). If  or   is used, the color of the lines on the item texture changes to match the corresponding explorer map.
 * : The zoom level of the resulting map. Defaults to 2.
 * : The size, in chunks, of the area to search for structures. The area checked is square, not circular. Radius 0 causes only the current chunk to be searched, radius 1 causes the current chunk and eight adjacent chunks to be searched, and so on. Defaults to 50.
 * : Don't search in chunks that have already been generated. Defaults to true.


 * explosion_decay - For loot tables of type 'block', removes some items from a stack, if there was an explosion. Each item has a chance of 1/explosion radius to be lost.


 * furnace_smelt - Smelts the item as it would be in a furnace. Used in combination with the  condition to cook food from animals on death.


 * fill_player_head - Adds required item tags of a player head
 * : Specifies an entity to be used for the player head. Set to  to use the entity that died or the player that gained the advancement, opened the container or broke the block,   for the killer, or   for a killer that is a player.


 * limit_count - Limits the count of every item stack.
 * : Specifies the exact limit to use.
 * : Specifies a random limit within a range.
 * : Minimum limit to use.
 * : Maximum limit to use.


 * looting_enchant - Adjusts the stack size based on the level of the Looting enchantment on the  entity.
 * : Specifies an exact number of additional items per level of looting.
 * : Specifies a random number (within a range) of additional items per level of looting. Note the random number generated may be fractional, rounded after multiplying by the looting level.
 * : Minimum increase.
 * : Maximum increase.
 * : Specifies the maximum amount of items in the stack after the looting calculation. If the value is 0, no limit is applied.


 * set_attributes - Add attribute modifiers to the item.
 * : Name of the modifier.
 * : The name of the attribute this modifier is to act upon.
 * : Must be either "addition", "multiply_base" or "multiply_total".
 * : Specifies the exact amount of change of the modifier.
 * : Specifies a random amount within a range.
 * : Minimum amount.
 * : Maximum amount.
 * : Optional : UUID of the modifier following. If none specified, a new UUID is generated.
 * : Slots the item must be in for the modifier to take effect, this value can be one of the following : "mainhand", "offhand", "feet", "legs", "chest", or "head".
 * : One of the listed slots is chosen randomly.
 * : Slots the item must be in for the modifier to take effect, this value can be one of the following : "mainhand", "offhand", "feet", "legs", "chest", or "head".
 * : One of the listed slots is chosen randomly.


 * set_contents - For loot tables of type 'block', sets the contents of a container block item to a list of entries.
 * : The entries to use as contents.


 * set_count - Sets the stack size.
 * : Specifies the exact stack size to set.
 * : Specifies a random stack size within a range.
 * : The distribution type. Arguments lie in the count compound.
 * uniform: Uniform distribution. A random integer is chosen with probability of each number being equal.
 * : Minimum stack size.
 * : Maximum stack size.
 * binomial: Binomial distribution. Roll a number of times, each having a chance of adding 1 to the stack size.
 * : Number of rolls.
 * : Chance of each roll.


 * set_damage - Sets the item's damage value (durability) for tools.
 * : Specifies the damage fraction to set (1.0 is undamaged, 0.0 is zero durability left).
 * : Specifies a random damage fraction within a range.
 * : Minimum value.
 * : Maximum value.

<span id="function_set_lore">
 * set_lore - Adds lore to the item
 * : List of JSON text components. Each list entry represents one line of the lore.
 * : Specifies the entity to act as the source  in the JSON text component. Set to   to use the entity that died or the player that gained the advancement, opened the container or broke the block,   for the killer, or   for a killer that is a player.
 * : If true, replaces all existing lines of lore, if false appends the list.

<span id="function_set_name">
 * set_name - Adds display name of the item.
 * : A JSON text component name, allowing color, translations, etc.
 * : Specifies an entity to act as source  in the JSON text component. Set to   to use the entity that died or the player that gained the advancement, opened the container or broke the block,   for the killer, or   for a killer that is a player.

<span id="function_set_nbt">
 * set_nbt - Adds NBT data to the item.
 * : Tag string to add, similar to those used by commands. Note that the first bracket is required and quotation marks need to be escaped using a backslash.

<span id="function_set_stew_effect">
 * set_stew_effect - Sets the status effects for suspicious stew.
 * : The effects to apply.
 * An effect.
 * : The effect ID.
 * : The duration of the effect.

Conditions
Loot tables use various conditions that add requirements to a drop, pool, or function. Below are a list of valid conditions, and the tags used by them. The tags are placed in the same condition object as.

Moreover, the conditions from directory in the   directory in data packs have the same structure as the loot conditions.

<span id="condition_alternative">
 * alternative - Joins conditions from parameter terms with "or".
 * : A list of conditions to join using 'or'.

<span id="condition_block_state_property">
 * block_state_property - Check properties of a block state.
 * : A block ID. Test fails if the block doesn't match.
 * : (Optional) A map of block property names to values. All values are strings. Test fails if the block doesn't match.

<span id="condition_damage_source_properties">
 * damage_source_properties - Check properties of damage source.
 * : Predicate applied to the damage source.

<span id="condition_entity_properties">
 * entity_properties - Test properties of an entity.
 * : Specifies the entity to check for the condition. Set to  to use the entity that died or the player that gained the advancement, opened the container or broke the block,   for the killer, or   for a killer that is a player.
 * : Predicate applied to the entity.

<span id="condition_entity_scores">
 * entity_scores - Test the scoreboard scores of an entity.
 * : Specifies the entity to check for the condition. Set to  to use the entity that died or the player that gained the advancement, opened the container or broke the block,   for the killer, or   for a killer that is a player.
 * : Scores to check. All specified scores must pass for the condition to pass.
 * : Key name is the objective while the value is the exact score value required for the condition to pass.
 * : Key name is the objective while the value specifies a range of score values required for the condition to pass.
 * : Minimum score.
 * : Maximum score.

<span id="condition_inverted">
 * inverted - Inverts condition from parameter term.
 * : The condition to be negated.

<span id="condition_killed_by_player">
 * killed_by_player - Test if a  entity is available.
 * : If true, the condition passes if  is not available.

<span id="condition_location_check">
 * location_check - Checks if the current location matches.
 * - optional offsets to location
 * - optional offsets to location
 * - optional offsets to location
 * Predicate applied to location, uses same structure as advancements.

<span id="condition_match_tool">
 * match_tool - Checks tool.
 * Predicate applied to item, uses same structure as advancements.

<span id="condition_random_chance">
 * random_chance - Test if a random number 0.0–1.0 is less than a specified value.
 * : Success rate as a number 0.0–1.0.

<span id="condition_random_chance_with_looting">
 * random_chance_with_looting - Test if a random number 0.0–1.0 is less than a specified value, affected by the level of Looting on the  entity.
 * : Base success rate.
 * : Looting adjustment to the base success rate. Formula is.

<span id="condition_reference">
 * reference - Test if another referred condition (predicate) passes.
 * : The namespaced ID of the condition (predicate) referred to. Cyclic reference causes a parsing failure.

<span id="condition_survives_explosion">
 * survives_explosion - Returns true with 1/explosion radius probability.

<span id="condition_table_bonus">
 * table_bonus - Passes with probability picked from table, indexed by enchantment level.
 * : The Namespaced ID of an enchantment.
 * : List of probabilities for enchantment level, indexed from 0.

<span id="condition_time_check">
 * time_check - Checks the current time
 * : The time value in ticks.
 * : The maximum value.
 * : The minimum value.
 * : If present, time is modulo-divided by this value (for example, if set to 24000, value operates on a time period of days).
 * : If present, time is modulo-divided by this value (for example, if set to 24000, value operates on a time period of days).

<span id="condition_tool_enchantment">
 * tool_enchantment - Test the tool's enchantments.
 * : List of enchantments the tool must have.
 * An enchantment.
 * : The enchantment namespaced ID.
 * : The level this enchantment has to be.
 * : The minimum level.
 * : The maximum level.

<span id="condition_weather_check">
 * weather_check  - Checks for a current weather state
 * : If true, the condition evaluates to true only if it's raining.
 * : If true, the condition evaluates to false only if it's thundering.

List of loot tables
Below is a list of all loot tables that exist by default. More tables can be added in the world save for use with custom maps. Note that some blocks, such as fire, bedrock, end portals and other blocks unbreakable in survival do not have loot tables, some blocks share loot tables (namely wall and floor variants of blocks) and that certain drops, namely head drops from charged creepers and the wither's nether star, are currently not covered by loot tables.

Data packs
Custom data packs use loot tables to change what loot can spawn in containers or drop by mobs. They can either change existing loot tables or create new ones. This is the file structure:


 * world save folder
 * datapacks
 * data pack
 * data
 * minecraft
 * loot_tables
 * See
 * custom_namespace
 * loot_tables
 * loot table name.json

The JSON files go in this folder. Vanilla loot tables are grouped into 4 categories: gameplay (fishing), entities, blocks, and chests, with some tables being in subfolders of those. For example, the file for zombies would go in. This makes every zombie in that world use the datapack's loot table rather than the default zombie loot table.

Loot tables are namespaced. To create a custom loot table, first create a new folder for the custom namespace, and then create loot tables within following a similar structure. Then, summon the mob with the data tag DeathLootTable set to the name of the directory and file (without the .json extension), such as.