Loot table

From Minecraft Wiki
Jump to: navigation, search

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

Usage[edit]

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

For Chests, Trapped Chests, Hoppers, Storage Minecarts, Minecarts with Hoppers, Dispensers, Droppers, and Shulker Boxes:

    •  LootTable: 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 which is part of a double chest, only the half corresponding to the tagged single-chest will be affected.
    •  LootTableSeed: Seed for generating the loot table. Works similarly to the seeds for worlds. 0 or omitted will use a random seed.

These tags will be removed once the items have been interacted with (by opening the container, breaking the container, etc.), and only then will items be put in the container.

For Mobs:

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

The loot tables of mobs and containers can be altered with /entitydata, /blockdata, /execute store and /data merge. The player could also grant a loot table to an entity or drop it in the world with /loot.

Tags[edit]

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

  •  The root tag
    •  type: Optional type of the loot table. Must be one of empty if the loot table does not generate any loot, entity for loot an entity drops, chest for a treasure chest, fishing for a fishing loot table, advancement_reward if it's used as a reward for an advancement or generic if none of the above apply.
    •  pools: 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.
      • A pool.
        •  conditions: Determines conditions for this pool to be used. If multiple conditions are specified, all must pass.
          • A condition.
            •  condition: Name of condition. Valid conditions are described below.
        •  rolls: Specifies the exact number of rolls on the pool.
        •  rolls: Specifies a random number of rolls within a range.
          •  min: Minimum number of rolls. Inclusive.
          •  max: Maximum number of rolls. Inclusive.
        •  bonus_rolls: Specifies the exact number of bonus rolls on the pool per point of luck. Rounded down after multiplying.
        •  bonus_rolls: Specifies a random number of bonus rolls within a range. Rounded down after multiplying.
          •  min: Minimum number of bonus rolls. Inclusive.
          •  max: Maximum number of bonus rolls. Inclusive.
        •  entries: 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.
            •  conditions: Determines conditions for this entry to be used. If multiple conditions are specified, all must pass.
              • A condition.
            •  type: Namespaced ID type of entry. Can be item for item entries, tag for item tags, loot_table to produce items from another loot table, group for child entries, alternatives to select one sub-entry from a list, sequence to select sub-entries until one entry cannot be granted, dynamic to generate block specific drops, or empty for an entry that generates nothing.
            •  name:
              • For type 'item', ID name of the item to be produced, e.g. minecraft:diamond. The default, if not changed by functions, is a stack of 1 of the default instance of the item.
              • For type 'tag' item tag to be used, e.g. minecraft:arrows.
              • For type 'loot_table', loot table to be used, e.g. minecraft:gameplay/fishing/junk.
              • For type 'dynamic', can be contents for block entity contents or self for banners and player skulls.
            •  children:
              • For type 'group' a list of entries that are used to generate loot. Can be used for convinience, e.g. if one condition applies for multiple entries.
              • For type 'alternatives' a list of entries of which the first, and only the first, succesful 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 will be generated
            •  expand: 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.
            •  functions: For type 'item', applies functions to the item stack being produced. Functions are applied in order, so for example looting_enchant must be after set_count to work correctly.
              • A function.
                •  function: Namespaced ID of the function to apply. Valid functions are described below.
                •  conditions: Determines conditions for this function to be applied. If multiple conditions are specified, all must pass.
                  • A condition.
            •  weight: 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 weighttotal of all considered entries' weights).
            •  quality: Modifies the entry's weight based on the killing/opening/fishing player's luck attribute. Formula is floor( weight + (quality * generic.luck)).

Functions[edit]

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  function:.

  • minecraft:apply_bonus - Applies a predefined bonus formula.
    •  enchantment: Enchantment ID used for level calculation.
    •  formula: Can be binomial_with_bonus_count for a biominal distribution (with n=level + extra, p=probability), uniform_bonus_count for uniform distribution (from 0 to level * bonusMultiplier), or ore_drops for a special function used for ore drops in the vanilla game (count * (max(0, random(0..1) - 1) + 1)).
    •  parameters: Values required for the formula.
      •  extra: For formula 'binomial_with_bonus_count', the extra value.
      •  probability : For formula 'binomial_with_bonus_count', the probability.
      •  bonusMultiplier : For formula 'uniform_bonus_count', the bonus multiplier.
  • minecraft:copy_name - For loot table type 'block', copies a block entity's CustomName tag into the item's display.Name tag.
    •  source: "block_entity" - Needs to be set to 'block_entity'.* A function
  • minecraft:copy_nbt - Copies nbt to the item's tag tag.
    •  source: Specifies the source. Set to block_entity for the block entity of the destroyed block, this to use the entity that died, killer for the killer, or killer_player for a killer that is a player.
    •  ops: A list of copy operations.
      • An operation
        •  source: The nbt path to copy from.
        •  target: The nbt path to copy to, starting from the item's tag tag.
        •  op: Can be replace to replace any existing contents of the target, append to append to a list, or merge to merge into a compound tag.
  • minecraft:enchant_randomly - Enchants the item with one randomly-selected enchantment. The level of the enchantment, if applicable, will be random.
    •  enchantments: List of enchantment names to choose from. If omitted, all enchantments applicable to the item will be possible.
  • minecraft:enchant_with_levels - Enchants the item, with the specified enchantment level (roughly equivalent to using an enchantment table at that level).
    •  treasure: Determines whether treasure enchantments are allowed on this item.
    •  levels: Specifies the exact enchantment level to use.
    •  levels: Specifies a random enchantment level within a range.
      •  min: Minimum level to use.
      •  max: Maximum level to use.
  • minecraft:exploration_map - Converts an empty map into an explorer map leading to a nearby generated structure.
    •  destination: The type of generated structure to locate. Accepts any of the StructureTypes used by the /locate command (case insensitive).
    •  decoration: The icon used to mark the destination on the map. Accepts any of the map icon text IDs (case insensitive). If mansion or monument is used, the color of the lines on the item texture will change to match the corresponding explorer map.
    •  zoom: The zoom level of the resulting map. Defaults to 2.
    •  search_radius: 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.
    •  skip_existing_chunks: Don't search in chunks that have already been generated. Defaults to true.
  • minecraft: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.
  • minecraft:furnace_smelt - Smelts the item as it would be in a furnace. Used in combination with the entity_properties condition to cook food from animals on death.
  • minecraft:fill_player_head - Adds required item tags of a player head
    •  entity: Specifies an entity to be used for the player head. Set to this to use the entity that died, killer for the killer, or killer_player for a killer that is a player.
  • minecraft:limit_count - Limits the count of every item stack.
    •  limit: Specifies the exact limit to use.
    •  limit: Specifies a random limit within a range.
      •  min: Minimum limit to use.
      •  max: Maximum limit to use.
  • minecraft:looting_enchant - Adjusts the stack size based on the level of the Looting enchantment on the killer entity.
    •  count: Specifies an exact number of additional items per level of looting.
    •  count: 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.
      •  min: Minimum increase.
      •  max: Maximum increase.
    •  limit: Specifies the maximum amount of items in the stack after the looting calculation. If the value is 0, no limit is applied.
  • minecraft:set_attributes - Add attribute modifiers to the item.
    •  modifiers
      •  A modifier
        •  name: Name of the modifier.
        •  attribute: The name of the attribute this modifier is to act upon.
        •  operation: Must be either "addition", "multiply_base" or "multiply_total".
        •  amount: Specifies the exact amount of change of the modifier.
        •  amount: Specifies a random amount within a range.
          •  min: Minimum amount.
          •  max: Maximum amount.
        •  id: Optional : UUID of the modifier following. If none specified, a new UUID will be generated.
        •  slot: 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".
        •  slot: One of the listed slots will be chosen randomly.
  • minecraft:set_contents - For loot tables of type 'block', sets the contents of a container block item to a list of entries.
    •  entries: The entries to use as contents.
  • minecraft:set_count - Sets the stack size.
    •  count: Specifies the exact stack size to set.
    •  count: Specifies a random stack size within a range.
      •  min: Minimum stack size.
      •  max: Maximum stack size.
  • minecraft:set_damage - Sets the item's damage value (durability) for tools.
    •  damage: Specifies the damage fraction to set (1.0 is undamaged, 0.0 is zero durability left).
    •  damage: Specifies a random damage fraction within a range.
      •  min: Minimum value.
      •  max: Maximum value.
  • minecraft:set_lore - Adds lore to the item
    •  lore: List of JSON text components. Each list entry represents one line of the lore.
    •  entity: Specifies the entity to act as the source @s in the JSON text component. Set to this to use the entity that died, killer for the killer, or killer_player for a killer that is a player.
    •  replace: If true, replaces all existing lines of lore, if false appends the list.
  • minecraft:set_name - Adds display name of the item.
    •  name: A simple name like with an anvil.
    •  name: A JSON text component name, allowing color, translations, etc.
    •  entity: Specifies an entity to act as source @s in the JSON text component. Set to this to use the entity that died, killer for the killer, or killer_player for a killer that is a player.
  • minecraft:set_nbt - Adds NBT data to the item.
    •  tag: 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[edit]

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  condition:.

  • minecraft:alternative - Joins conditions from parameter terms with "or".
    •  terms: A list of conditions to join using 'or'.
  • minecraft:block_state_property - Check properties of block state.
    •  block: id of block;test will fail if broken block doesn't match.
  • minecraft:damage_source_properties - Check properties of damage source.
    •  properties: map of property:value pairs.
  • minecraft:entity_present - Returns true if entity is set.
  • minecraft:entity_properties - Test properties of an entity.
    •  entity: Specifies the entity to check for the condition. Set to this to use the entity that died, killer for the killer, or killer_player for a killer that is a player.
    •  predicate: Predicate applied to location, uses same structure as advancements.
    •  properties: Properties to be checked.
      •  is_on_fire: Test whether the entity is or is not on fire.
      •  is_sneaking: Test whether the entity is or is not sneaking.
      •  is_sprinting: Test whether the entity is or is not sprinting.
      •  is_swimming: Test whether the entity is or is not swimming.
      •  is_baby: Test whether the entity is or is not a baby variant.
  • minecraft:entity_scores - Test the scoreboard scores of an entity.
    •  entity: Specifies the entity to check for the condition. Set to this to use the entity that died, killer for the killer, or killer_player for a killer that is a player.
    •  scores: Scores to check. All specified scores must pass for the condition to pass.
      •  A score: Key name is the objective while the value is the exact score value required for the condition to pass.
      •  A score: Key name is the objective while the value specifies a range of score values required for the condition to pass.
        •  min: Minimum score.
        •  max: Maximum score.
  • minecraft:inverted - Inverts condition from parameter term.
    •  term: The condition to be negated.
  • minecraft:killed_by_player - Test if a killer_player entity is available.
    •  inverse: If true, the condition passes if killer_player is not available.
  • minecraft:location_check - Checks if the current location matches.
    •  predicate: Predicate applied to location, uses same structure as advancements.
  • minecraft:match_tool - Checks tool.
    •  predicate: Predicate applied to item, uses same structure as advancements.
  • minecraft:random_chance - Test if a random number 0.0–1.0 is less than a specified value.
    •  chance: Success rate as a number 0.0–1.0.
  • minecraft: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 killer entity.
    •  chance: Base success rate.
    •  looting_multiplier: Looting adjustment to the base success rate. Formula is chance + (looting_level * looting_multiplier).
  • minecraft:survives_explosion - Returns true with 1/explosion radius probability.
  • minecraft:table_bonus - Passes with probability picked from table, indexed by enchantment level.
    •  enchantment: Id of enchantment.
    •  chances: List of probabilities for enchantment level, indexed from 0.
  • minecraft:tool_enchantment
    •  enchantments: List of enchantments that need to be applied to the tool.
      • An enchantment.
        •  enchantment: The enchantment name ID.
        •  levels: The level this enchantment has to be.
          •  min: The minimum level.
          •  max: The maximum level.
  • minecraft:weather_check - Checks for a current wheather state
    •  raining: If true, the condition evaluates to true only if it's raining.
    •  thundering: If true, the condition evaluates to false only if it's thundering.

List of loot tables[edit]

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.

Data packs[edit]

Custom data packs use loot tables to change what loot will 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

The JSON files go in this folder. Vanilla loot tables are grouped into 3 categories (along with empty): gameplay (fishing), entities, and chests, with some tables being in subfolders of those. For example, the file for zombies would go in datapacks/pack name/data/minecraft/loot_tables/entities/zombie.json. This will make 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 DeathLootTable:"custom_namespace:path/to/table".

History[edit]

Java Edition
1.9October 19, 2015Dinnerbone announces loot tables.
15w43aAdded loot tables.
15w43bAdded condition entity_scores.
15w43cRenamed "villager_golem.json" to "iron_golem.json"
Added fishing loot tables, sheep without wool, and zombie and skeleton horses.
Renamed the tag  item: to  name:, and the tag  items: to  entries:
Added the tag  type: and support to load a loot table instead of an item.
Added the tag  luck: to default files, though it currently does nothing in the code.
Added the function set_damage
15w44aAdded the function enchant_randomly and set_attributes.
15w44bAdded the  quality tag.
Removed  luck and  luck_multiplier tags.
Added the  bonus_rolls tag.
15w51aA player in spectator mode will no longer trigger a container to use its loot table to generate loot.
1.9.1pre1Loot tables now work with dispensers and droppers.
Added default table chests/jungle_temple_dispenser.
1.1116w32aDonkey, mule, husk and zombie villager now each draw from their own loot tables, rather than drawing from the horse and zombie loot tables, respectively
16w43aVillagers, vexes and ender dragons are now able to draw from their own loot tables
1.1317w43aCustom loot tables have been moved into data packs.
1.1418w43aBlock drops changed to use loot tables too.
18w44aAdded loot tables for cat, cat_morning_gift, player, wither.
Added loot tables for new blocks.
18w46aAdded loot table for illusioners.
18w48aAdded more loot tables for villages, some of which are currently unused.
Removed loot table: village_blacksmith
18w49avillage_savanna_house and village_snowy_house loot tables are now used.
Added more loot tables for villages.
18w50avillage_desert house and village_taiga_house loot tables are now used, making all previously unused loot tables no longer unused.

Issues[edit]

Issues relating to "Loot table" are maintained on the bug tracker. Report issues there.