Loot table

Loot tables are 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 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: These tags will be removed once the chest is opened and only then items will be put in the chest.
 * : Loot table to be used to fill the chest when it is next opened. 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 entities:


 * : 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.
 * : Seed for generating the loot table. 0 or omitted will use a random seed.

The loot tables of entities and chests can be altered with and.

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.
 * A list of all items that can be produced by this pool. One item is chosen per roll as a weighted random selection.
 * Determines conditions for this item to be used. If multiple conditions are specified, all must pass. If the conditions fail, the roll does not produce an item.
 * Name of condition. Valid conditions are described below.
 * Type of entry. Can be  for item entries, or   to load a loot table from the folder.
 * ID name of the item to be produced, e.g., or loot table to be use, e.g.  . The default, if not changed by  , is a stack of 1 of the default instance of the item. If omitted, this entry represents a weighted chance for receiving no item on the roll and   and   must also be omitted.
 * 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 item will be chosen out of all the items in the pool. Items with higher weights will be used more often (chance is $this item's weight/total of all items' weights$).
 * Increases the item's  based on luck being applied to this application of the loot table, formula is  . However, luck is currently always 0.
 * 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 item will be chosen out of all the items in the pool. Items with higher weights will be used more often (chance is ⇭⇭⇭).
 * Increases the item's  based on luck being applied to this application of the loot table, formula is  . However, luck is currently always 0.
 * Determines how often this item will be chosen out of all the items in the pool. Items with higher weights will be used more often (chance is ⇭⇭⇭).
 * Increases the item's  based on luck being applied to this application of the loot table, formula is  . However, luck is currently always 0.
 * Increases the item's  based on luck being applied to this application of the loot table, formula is  . However, luck is currently always 0.

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_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_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 - Determines item damage value (durability) for tools.
 * Specifies the exact value to set.
 * Specifies a random value within a range.
 * Minimum value.
 * Maximum value.
 * set_data - Determines the item data ("damage") 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.

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. Note that this is broken as of 15w43b.
 * Key name is the objective while the value specifies a range of score values required for the condition to pass. Note that only the minimum score works as of 15w43b.
 * 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
 * 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
 * wolf
 * zombie
 * zombie_horse
 * zombie_pigman
 * gameplay
 * fishing
 * fish.json
 * junk.json
 * treasure.json
 * fishing.json - Loads the three tables from the fishing folder, applying luck to each one
 * empty - Contains no items

History
可抢夺物品表