Loot table

Loot tables are upcoming technical JSON tables that represent what items should be in a naturally generated chest, what items should drop when killing a mob, or what items can be fished.

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

For Chests, Trapped Chests, Storage Minecarts and Minecarts with Hoppers: These tags will be removed once the items have been interacted with (by opening the chest, breaking the chest, etc.), and only then will items be put in the chest.
 * : Loot table to be used to fill the chest when it is next opened, or the items are otherwise interacted with. When the chest is part of a double chest, only the half corresponding to the tagged single-chest will be affected.
 * : Seed for generating the loot table. 0 or omitted will use a random seed.
 * : Seed for generating the loot table. 0 or omitted will use 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. 0 or omitted will use a random seed.

The loot tables of Mobs and Chests can be altered with and.

Custom maps can use loot tables to change what loot will spawn in chests or drop by mobs. They can either modify existing loot tables or create new ones. This is the file structure:


 * data
 * loot_tables
 * loot_tables

Each folder under "loot_tables" is a namespace. The default files are under the namespace "minecraft", but custom maps and mods each have their own namespaces. For example, if you were to create a custom map called "Awesome Parkour Map," your namespace might be "awesome_parkour_map" (they can't contain spaces). It would contain any loot tables the map uses.

To override the default loot tables, you would place them in the "minecraft" namespace. They are organized by entities, chests, and fishing, as shown in the section List of loot tables. To use a custom namespace, set the loot table tag to "namespace:table_name", where "namespace" is the name of your namespace and "table_name" is the filename of your table, without the .json extension.

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


 * A list of all pools for this entity. Each pool used will generate items from its list of items based on the number of rolls. Pools are applied in order.
 * Determines conditions for this pool to be used. If multiple conditions are specified, all must pass.
 * Name 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.
 * Maximum number of rolls.
 * 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.
 * Maximum number of bonus rolls.
 * 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.
 * Determines conditions for this entry to be used. If multiple conditions are specified, all must pass.
 * Name of condition. Valid conditions are described below.
 * Type of entry. Can be  for item entries,   to produce items from another loot table, 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 'loot_table', loot table to be used, e.g..
 * 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.
 * Name 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.
 * Name of condition. Valid conditions are described below.
 * Determines how often this entry will be chosen out of all the entries in the pool. Entries with higher weights will be 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.
 * 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.
 * Name 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.
 * Name of condition. Valid conditions are described below.
 * Determines how often this entry will be chosen out of all the entries in the pool. Entries with higher weights will be used more often (chance is ⇭⇭⇭).
 * Modifies the entry's  based on the killing/opening/fishing player's luck attribute. Formula is.
 * Determines how often this entry will be chosen out of all the entries in the pool. Entries with higher weights will be 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.


 * enchant_randomly - Enchants the item with one randomly-selected enchantment. The level of the enchantment, if applicable, will be random.
 * List of enchantment names to choose from. If omitted, all enchantments applicable to the item will be 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.
 * furnace_smelt - Smelts the item as it would be in a furnace. Used in combination with the  condition to cook food for animals on death.
 * 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, and will be rounded after multiplying by the looting level.
 * Minimum increase.
 * Maximum increase.
 * 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 amout.
 * Optional : UUID of the modifier following. If non specified, a new UUID will be 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", "torso", or "head".
 * One of the listed slots will be chosen randomly.
 * set_count - Sets the stack size.
 * Specifies the exact stack size to set.
 * Specifies a random stack size within a range.
 * Minimum stack size.
 * Maximum stack size.
 * 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.
 * set_data - Sets the item data value of the item.
 * Specifies the exact value to set.
 * Specifies a random value within a range.
 * Minimum value.
 * Maximum value.
 * set_nbt - Adds NBT data to an 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.
 * set_nbt - Adds NBT data to an 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.

Conditions
Loot tables use various conditions which 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.


 * entity_properties - Test properties of an entity.
 * Specifies the entity to check for the condition. Set to  to use the entity that died,   for the killer, or   for a killer that is a player.
 * Properties to be checked.
 * Test whether the entity is or is not on fire.
 * 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,   for the killer, or   for a killer that is a player.
 * Scores to check. All specifies 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.
 * killed_by_player - Test if a  entity is available.
 * If true, the condition passes if  is not available.
 * 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.
 * 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.

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.


 * loot_tables
 * chests - Items from loot chests
 * abandoned_mineshaft - Minecarts with chests found in abandoned mine shafts
 * desert_pyramid - Chests found in the treasure room inside Desert Temples
 * end_city_treasure - Chests found in End Cities
 * igloo_chest - The chest that appears in the basements in igloos
 * jungle_temple - Chests found inside Jungle Temples
 * nether_bridge - Chests found in Nether Fortresses
 * simple_dungeon - Dungeon chests
 * spawn_bonus_chest - Bonus chests that appear in a new world when bonus chests are enabled
 * stronghold_corridor - Chests found on slab altars in corridors in strongholds
 * stronghold_crossing - The chest in the upper level of store rooms in strongholds
 * stronghold_library - Chests found in a library in strongholds
 * village_blacksmith - The chest found in the Blacksmith's house in a Village
 * entities - Items dropped from entities. May cause issues when applied to chests, due to some items spawning in stacks of 0
 * sheep - Sheep with wool, also inherited by colored sheep
 * black
 * blue
 * brown
 * cyan
 * gray
 * green
 * light_blue
 * lime
 * magenta
 * orange
 * pink
 * purple
 * red
 * silver
 * white
 * yellow
 * bat
 * blaze
 * cave_spider
 * chicken
 * cow
 * creeper
 * elder_guardian
 * enderman
 * endermite
 * ghast
 * giant
 * guardian
 * horse
 * iron_golem
 * magma_cube
 * mushroom_cow
 * ocelot
 * pig
 * rabbit
 * sheep - Sheep without wool
 * shulker
 * silverfish
 * skeleton
 * skeleton_horse
 * slime
 * snowman - Snow golems
 * spider
 * squid
 * witch
 * wolf
 * zombie
 * zombie_horse
 * zombie_pigman
 * gameplay
 * fishing
 * fish
 * junk
 * treasure
 * fishing - Loads the three tables from the fishing folder, applying luck to each one
 * empty - Contains no items

Custom Maps
Custom maps can use loot tables to change what loot will spawn in chests or drop by mobs. They can either change existing loot tables or create new ones. This is the file structure:


 * data
 * loot_tables
 * minecraft
 * minecraft

The JSON files go in this folder. For example, the file for zombies would go in data/loot_tables/minecraft/entities/zombie.json. This will make every zombie in that world use your loot table rather than the default zombie loot table. To use custom loot tables, add the file to the "minecraft" directory. Then, summon the mob with the data tag DeathLootTable set to the name of the file (without the .json extension).

History
可抢夺物品表