Loot table

From Minecraft Wiki
(Redirected from Loot tables)
Jump to: navigation, search

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

Usage[edit | edit source]

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 and /blockdata.

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

  • <world save folder>
    • data
      • 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[edit | edit source]

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


  •  The root tag

    •  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

                •  condition: Name of condition. Valid conditions are described below.

            •  type: Type of entry. Can be item for item entries, loot_table to produce items from another loot table, 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 'loot_table', loot table to be used, e.g. minecraft:gameplay/fishing/junk.

            •  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: Name 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

                    •  condition: Name of condition. Valid conditions are described below.

            •  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 | edit source]

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

  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • set_data - Sets the item data value of the item.

    •  data: Specifies the exact value to set.

    •  data: Specifies a random value within a range.

      •  min: Minimum value.

      •  max: Maximum value.
  • set_nbt - Adds NBT data to an 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 | edit source]

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

  • 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.

    •  properties: Properties to be checked.

      •  on_fire: Test whether the entity is or is not on fire.
  • 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.
  • killed_by_player - Test if a killer_player entity is available.

    •  inverse: If true, the condition passes if killer_player is not available.
  • 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.
  • 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).

List of loot tables[edit | edit source]

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
    • 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
      • donkey
      • elder_guardian
      • ender_dragon
      • enderman
      • endermite
      • evocation_illager
      • ghast
      • giant
      • guardian
      • horse
      • husk
      • iron_golem
      • llama
      • magma_cube
      • mule
      • mushroom_cow
      • ocelot
      • parrot
      • pig
      • polar bear
      • rabbit
      • sheep - Sheep without wool, also inherited by sheep with wool
      • shulker
      • silverfish
      • skeleton
      • skeleton_horse
      • slime
      • snowman - Snow golems
      • spider
      • squid
      • vex
      • villager
      • vindication_illager
      • witch
      • wither_skeleton
      • wolf
      • zombie
      • zombie_horse
      • zombie_pigman
      • zombie_villager
    • gameplay
      • fishing
        • fish - Also inherited by guardians and elder guardians
        • junk
        • treasure
      • fishing - Used to determine loot from fishing by loading the three tables from the fishing folder and applying luck to each one
    • empty - Contains no items

Custom Maps[edit | edit source]

Custom maps can 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>
    • data
      • loot_tables
        • minecraft
        • <custom directory>

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 add custom loot tables, create a new file in a new directory. 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:"customdirectory:path/to/table".

History[edit | edit source]

Official release
1.9 October 19, 2015 Dinnerbone announces loot tables.
15w43a Added loot tables.
15w43b Added condition entity_scores.
15w43c Renamed "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
15w44a Added the function enchant_randomly and set_attributes.
15w44b Added the
 quality tag.
Removed
 luck and
 luck_multiplier tags.
Added the
 bonus_rolls tag.
15w51a A player in spectator mode will no longer trigger a container to use its loot table to generate loot.
1.9.1 pre1 Loot tables now work with dispensers and droppers.
Added default table chests/jungle_temple_dispenser.
1.11 16w32a Donkey, mule, husk and zombie villager now each draw from their own loot tables, rather than drawing from the horse and zombie loot tables, respectively
16w43a Villagers, vexes and ender dragons are now able to draw from their own loot tables

Issues[edit | edit source]

Issues relating to “Loot table” are maintained on the issue tracker. Report issues there.