Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Loot table: Difference between revisions

From SAS Gaming Wiki
SyncBot (talk | contribs)
Sync: updated from Minecraft
SyncBot (talk | contribs)
Sync: updated from Minecraft
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Exclusive|java|customtext=This article describes only the loot table {{in|je}}.<br>See [https://learn.microsoft.com/en-us/minecraft/creator/documents/introductiontoloottables?view=minecraft-bedrock-stable the official documentation] for the loot table {{in|be}}.}}
{{Exclusive|java|customtext=This article describes only the loot table {{in|je}}.<br>See [https://learn.microsoft.com/en-us/minecraft/creator/documents/introductiontoloottables?view=minecraft-bedrock-stable the official documentation] for the loot table {{in|be}}.}}
'''Loot tables''' are technical [[Minecraft:JSON]] files that are used to dictate what items should generate in various situations, such as what [[Minecraft:Chest loot|items should be in naturally generated containers]], what [[Minecraft:Drops|items should drop when breaking a block]] or [[Minecraft:Drops|killing a mob]], [[Minecraft:Fishing|what items can be fished]], and more. It does not affect dropped [[Minecraft:experience]], or dropped non-item entities such as [[Minecraft:slime]]s from larger slimes or [[Minecraft:silverfish]] from infested blocks. In the {{cmd|loot}} command, a loot table can be specified in [[Minecraft:SNBT]] format.
'''Loot tables''' are technical [[Minecraft:JSON]] files that are used to dictate what items should generate in various situations, such as what [[Minecraft:Chest loot|items should be in naturally generated containers]], what [[Minecraft:Drops|items should drop when breaking a block]] or [[Minecraft:Drops|killing a mob]], [[Minecraft:Fishing|what items can be fished]], and more. It does not affect dropped [[Minecraft:experience]], or dropped non-item entities such as [[Minecraft:slime]]s from larger slimes or [[Minecraft:silverfish]] from infested blocks. In the {{cmd|loot}} command, a loot table can be specified in [[Minecraft:SNBT]] format.


Line 199: Line 200:


== Number provider ==
== Number provider ==
Loot tables use '''number providers''' in some places that accept an {{nbt|int}} or {{nbt|float}}. They can either be defined as a constant value or as an object.
{{main|Number provider}}
 
Loot tables use '''number providers''' in some places that accept an {{nbt|int}} or {{nbt|float}}.  
<div class="treeview">
* {{nbt|int}}{{nbt|float}}: Constant number provider.
</div>
 
Or:
<div class="treeview">
* {{nbt|compound}}: The root tag. Shorthand for a uniform distribution.
** {{nbt|int}}{{nbt|float}}{{nbt|compound|min}}: Number provider. The minimum value.
** {{nbt|int}}{{nbt|float}}{{nbt|compound|max}}: Number provider. The maximum value.
</div>
 
Or:
<div class="treeview">
* {{nbt|compound}}: The root tag.
** {{nbt|string|type}}: The number provider type as a [[Minecraft:resource location]].
** Extra fields of the number provider, described below.
</div>
 
The possible values for {{nbt|string|type}} and associated extra contents:
 
<div class="treeview" id="constant" style="margin-block-end: 1em;">
* '''constant''' &mdash; A constant value.
** {{nbt|int}}{{nbt|float|value}}: The exact value.
</div>
 
<div class="treeview" id="uniform" style="margin-block-end: 1em;">
* '''uniform''' &mdash; A random number following a uniform distribution between two values (inclusive).
** {{nbt|int}}{{nbt|float}}{{nbt|compound|min}}: Number provider. The minimum value.
** {{nbt|int}}{{nbt|float}}{{nbt|compound|max}}: Number provider. The maximum value.
</div>
 
<div class="treeview" id="binomial" style="margin-block-end: 1em;">
* '''binomial''' &mdash; A random number following a [[Minecraft:wikipedia:Binomial distribution|binomial distribution]].
** {{nbt|int}}{{nbt|compound|n}}: Number provider. The amount of trials.
** {{nbt|float}}{{nbt|compound|p}}: Number provider. The probability of success on an individual trial.
</div>
 
<div class="treeview" id="score" style="margin-block-end: 1em;">
* '''score''' &mdash; To query and use a scoreboard value.
** {{nbt|compound|target}}: To choose which player name or entity UUID to query.
*** {{nbt|string|type}}: Set to {{cd|fixed}} to manually specify a player name or UUID. Set to {{cd|context}} to use an entity from loot context.
*** {{nbt|string|name}}: Included only if {{nbt|string|type}} is set to {{cd|fixed}}. Specifies the name of the player, or the entity's [[Minecraft:Universally unique identifier|UUID]] <small>(in hypenated hexadecimal format)</small> whose score to query.
*** {{nbt|string|target}}: Included only if {{nbt|string|type}} is set to {{cd|context}}. Specifies an entity from [[#Loot context types|loot context]] to query the score of. Can be {{Loot entity target}}.
** {{nbt|string|score}}: The scoreboard objective to query on the selected player name or UUID.
** {{nbt|float|scale}}: Optional. Scale to multiply the score before returning it.
</div>
 
<div class="treeview" id="storage" style="margin-block-end: 1em;">
* '''storage''' &mdash; A value in command storage.
** {{nbt|string|storage}}: The [[Minecraft:resource location]] of the storage.
** {{nbt|string|path}}: The [[Minecraft:nbt path]] to the field in storage.
</div>
 
<div class="treeview" id="enchantment_level" style="margin-block-end: 1em;">
* '''enchantment_level''' &mdash; A value dependent on the level of the [[#Loot context types|loot context]] enchantment
** {{nbt|string|amount}}: [[Minecraft:level-based value]] calculating the value based on the enchantment.
</div>
 
<div class="treeview" id="sum" style="margin-block-end: 1em;">
* '''sum''' &mdash; The sum of multiple value providers
** {{nbt|list|summands}}: List of number providers to sum.
</div>


== Loot context types ==
== Loot context types ==
Line 269: Line 208:


== History ==
== History ==
=== Individual tables ===
{{HistoryTable
|{{HistoryLine|java}}
|{{HistoryLine||1.9|dev=15w43a|{{info needed|List all of the initially implemented loot tables here, perhaps in collapsible form}}}}
|{{HistoryLine|||dev=15w43c|Renamed "villager_golem.json" to "iron_golem.json"
|Added [[Minecraft:fishing]] loot tables, [[Minecraft:sheep]] without [[Minecraft:wool]], and [[Minecraft:zombie horse|zombie]] and [[Minecraft:skeleton horse]]s.}}
|{{HistoryLine||1.9.1|dev=pre1|Added default table <code>chests/jungle_temple_dispenser</code>.}}
|{{HistoryLine||1.14|dev=18w43a|Block [[Minecraft:drops]] have been changed to use loot tables too.{{info needed|Cannwe get a full, collapsed list?}}}}
|{{HistoryLine|||dev=18w44a|Added loot tables for [[Minecraft:cat]]s, cat_morning_gift, players and [[Minecraft:wither]]s.
|Added loot tables for new blocks.}}
|{{HistoryLine|||dev=18w46a|Added loot table for [[Minecraft:illusioner]]s.}}
|{{HistoryLine|||dev=18w48a|Added {{tooltip|more loot tables|village_cartographer, village_desert_house, village_plains_house, village_savanna_house, village_snowy_house, village_taiga_house, village_tannery, village_weaponsmith}} for [[Minecraft:village]]s, some of which are currently unused.
|Removed loot table: village_blacksmith.}}
|{{HistoryLine|||dev=18w49a|village_savanna_house and village_snowy_house loot tables are now used.
|Added {{tooltip|more loot tables|village_armorer, village_butcher, village_mason, village_shepherd}} for [[Minecraft:village]]s.}}
|{{HistoryLine|||dev=18w50a|village_desert_house and village_taiga_house loot tables are now used, making all previously unused loot tables no longer unused.}}
|{{HistoryLine|||dev=?|Empty loot table is now hardcoded.}}
|{{HistoryLine||1.16|dev=?|Fire and soul fire now have defined empty loot tables, rather than being hardcoded to drop nothing.}}
|{{HistoryLine|||dev=?|Nether portal blocks now have defined empty loot tables, rather than being hardcoded to drop nothing.}}
|{{HistoryLine||1.20|dev=23w17a|Added the loot table {{cd|sniffer_digging}}.}}
|{{HistoryLine||1.20.5|dev=24w07a|Added <code>gameplay/panda_sneeze</code> loot table for drops when [[Minecraft:panda]]s sneeze.}}
|{{HistoryLine||1.21.2|dev=24w33a|Sheep shearing is now controlled by loot tables found as <code>shearing/sheep/{{ph|color}}</code>.
|Mooshroom shearing is now controlled by loot tables found as <code>shearing/mooshroom/{{ph|variant}}</code>.
|Snow golem shearing is now controlled by a loot table found as <code>shearing/snow_golem</code>.}}
|{{HistoryLine|||dev=24w35a|Special loot table empty has been removed and is no longer defined in vanilla data pack.
|Sheep now always uses a single loot table <code>entities/sheep</code>.
|Wool drops are still defined in sub-tables in <code>entities/sheep/{{ph|color}}</code>, but they are now just dispatched from the main table.
|Sheep shearing is now controlled by loot table found as <code>shearing/sheep</code>.
|Mooshroom shearing is now controlled by loot table found as <code>shearing/mooshroom</code>.}}
|{{HistoryLine|||dev=24w37a|Chickens laying eggs is now controlled by a loot table found at <code>gameplay/chicken_lay</code>.
|Armadillos randomly dropping scutes is now controlled by a loot table found at <code>gameplay/armadillo_shed</code>.
|The loot given by Villagers is now controlled by two additional loot tables: <code>gameplay/hero_of_the_village/unemployed_gift</code> and <code>gameplay/hero_of_the_village/baby_gift</code>.}}
|{{HistoryLine||1.21.9|dev=25w31a|Added {{cd|charged_creeper/root}}, {{cd|brush/armadillo}}, {{cd|gameplay/turtle_grow}}, {{cd|harvest/beehive}}, {{cd|harvest/cave_vine}}, and {{cd|carve/pumpkin}} loot tables.}}
|{{HistoryLine|||dev=25w32a|Added {{cd|harvest/sweet_berry_bush}} loot table.}}
|{{HistoryLine|upcoming java}}
|{{HistoryLine||26.3|dev=snap2|Added {{cd|till/rooted_dirt}} loot table for drops when [[Minecraft:rooted dirt]] is tilled with a hoe.}}
|{{HistoryLine|||dev=snap3|Multiple block loot tables now reference predicates for checking if a tool has [[Minecraft:Silk Touch]] and is [[Minecraft:shears]] instead of inlining a copy of those checks.}}
}}
=== Relevant data ===
=== Unsorted ===
{{HistoryTable
{{HistoryTable
|{{HistoryLine|java}}
|{{HistoryLine|java}}
Line 274: Line 256:
|{{HistoryLine|||dev=15w43a|Added loot tables.}}
|{{HistoryLine|||dev=15w43a|Added loot tables.}}
|{{HistoryLine|||dev=15w43b|Added condition '''entity_scores'''.}}
|{{HistoryLine|||dev=15w43b|Added condition '''entity_scores'''.}}
|{{HistoryLine|||dev=15w43c|Renamed "villager_golem.json" to "iron_golem.json"
|{{HistoryLine|||dev=15w43c|Renamed the tag {{nbt|string|item}}: to {{nbt|string|name}}:, and the tag {{nbt|compound|items}}: to {{nbt|compound|entries}}:
|Added [[Minecraft:fishing]] loot tables, [[Minecraft:sheep]] without [[Minecraft:wool]], and [[Minecraft:zombie horse|zombie]] and [[Minecraft:skeleton horse]]s.
|Renamed the tag {{nbt|string|item}}: to {{nbt|string|name}}:, and the tag {{nbt|compound|items}}: to {{nbt|compound|entries}}:
|Added the tag {{nbt|string|type}}: and support to load a loot table instead of an [[Minecraft:item]].
|Added the tag {{nbt|string|type}}: and support to load a loot table instead of an [[Minecraft:item]].
|Added the tag {{nbt|int|luck}}: to default files, though it currently does nothing in the code.
|Added the tag {{nbt|int|luck}}: to default files, though it currently does nothing in the code.
Line 285: Line 265:
|Added the {{nbt|compound|bonus_rolls}} tag.}}
|Added the {{nbt|compound|bonus_rolls}} tag.}}
|{{HistoryLine|||dev=15w51a|A [[Minecraft:player]] in [[Minecraft:spectator]] mode no longer triggers a container to use its loot table to generate loot.}}
|{{HistoryLine|||dev=15w51a|A [[Minecraft:player]] in [[Minecraft:spectator]] mode no longer triggers a container to use its loot table to generate loot.}}
|{{HistoryLine||1.9.1|dev=pre1|Loot tables now work with [[Minecraft:dispenser]]s and [[Minecraft:dropper]]s.
|{{HistoryLine||1.9.1|dev=pre1|Loot tables now work with [[Minecraft:dispenser]]s and [[Minecraft:dropper]]s.}}
|Added default table <code>chests/jungle_temple_dispenser</code>.}}
|{{HistoryLine||1.11|dev=16w32a|[[Minecraft:Donkey]]s, [[Minecraft:mule]]s, [[Minecraft:husk]]s and [[Minecraft:zombie villager]]s now each draw from their own loot tables, rather than drawing from the [[Minecraft:horse]] and [[Minecraft:zombie]] loot tables, respectively}}
|{{HistoryLine||1.11|dev=16w32a|[[Minecraft:Donkey]]s, [[Minecraft:mule]]s, [[Minecraft:husk]]s and [[Minecraft:zombie villager]]s now each draw from their own loot tables, rather than drawing from the [[Minecraft:horse]] and [[Minecraft:zombie]] loot tables, respectively}}
|{{HistoryLine|||dev=16w43a|[[Minecraft:Villager]]s, [[Minecraft:vex]]es and [[Minecraft:ender dragon]]s are now able to draw from their own loot tables.}}
|{{HistoryLine|||dev=16w43a|[[Minecraft:Villager]]s, [[Minecraft:vex]]es and [[Minecraft:ender dragon]]s are now able to draw from their own loot tables.}}
|{{HistoryLine||1.13|dev=17w43a|Custom loot tables have been moved into [[Minecraft:data pack]]s.}}
|{{HistoryLine||1.13|dev=17w43a|Custom loot tables have been moved into [[Minecraft:data pack]]s.}}
|{{HistoryLine||1.13|dev=18w01a|Added the function '''set_name'''.}}
|{{HistoryLine|||dev=18w01a|Added the function '''set_name'''.}}
|{{HistoryLine||1.14|dev=18w43a|Block [[Minecraft:drops]] have been changed to use loot tables too.
|{{HistoryLine||1.14|dev=18w43a|Loot tables received a bunch of new options.{{info needed|What options?}}
|Loot tables received a bunch of new options.
|Setting [[Minecraft:entity]] to "this" now refers to the [[Minecraft:player]] in [[Minecraft:chest]] and [[Minecraft:block]] loot tables.}}
|Setting [[Minecraft:entity]] to "this" now refers to the [[Minecraft:player]] in [[Minecraft:chest]] and [[Minecraft:block]] loot tables.}}
|{{HistoryLine|||dev=18w44a|Added loot tables for [[Minecraft:cat]]s, cat_morning_gift, players and [[Minecraft:wither]]s.
|{{HistoryLine|||dev=18w44a|Added the function '''set_lore'''.}}
|Added loot tables for new [[Minecraft:block]]s.|Added the function '''set_lore'''.}}
|{{HistoryLine|||dev=18w46a|Added loot table for [[Minecraft:illusioner]]s.}}
|{{HistoryLine|||dev=18w48a|Added {{tooltip|more loot tables|village_cartographer, village_desert_house, village_plains_house, village_savanna_house, village_snowy_house, village_taiga_house, village_tannery, village_weaponsmith}} for [[Minecraft:village]]s, some of which are currently unused.
|Removed loot table: village_blacksmith.}}
|{{HistoryLine|||dev=18w49a|village_savanna_house and village_snowy_house loot tables are now used.
|Added {{tooltip|more loot tables|village_armorer, village_butcher, village_mason, village_shepherd}} for [[Minecraft:village]]s.}}
|{{HistoryLine|||dev=18w50a|village_desert_house and village_taiga_house loot tables are now used, making all previously unused loot tables no longer unused.}}
|{{HistoryLine|||dev=?|Empty loot table is now hardcoded.}}
|{{HistoryLine||1.15|dev=19w34a|Added the function '''copy_state'''.}}
|{{HistoryLine||1.15|dev=19w34a|Added the function '''copy_state'''.}}
|{{HistoryLine||1.16|dev=20w12a|Added fishing_hook sub-predicate to check properties of the fishing hook.}}
|{{HistoryLine||1.16|dev=20w12a|Added fishing_hook sub-predicate to check properties of the fishing hook.}}
Line 308: Line 278:
|{{HistoryLine|||dev=23w14a|Added the function <code>reference</code>.}}
|{{HistoryLine|||dev=23w14a|Added the function <code>reference</code>.}}
|{{HistoryLine|||dev=23w17a|Renamed the <code>shards</code> dynamic drop to <code>sherds</code>.}}
|{{HistoryLine|||dev=23w17a|Renamed the <code>shards</code> dynamic drop to <code>sherds</code>.}}
|{{HistoryLine|||dev=23w17a|Added the loot table {{cd|sniffer_digging}}.}}
|{{HistoryLine|||dev=pre1|Made random sequences for loot tables deterministic.
|{{HistoryLine|||dev=pre1|Made random sequences for loot tables deterministic.
|Added <code>random_sequence</code> field.}}
|Added <code>random_sequence</code> field.}}
|{{HistoryLine|||dev=pre6|The ID of the random sequence is now an optional field.}}
|{{HistoryLine|||dev=pre6|The ID of the random sequence is now an optional field.}}
|{{HistoryLine||1.20.2|dev=23w32a|Added <code>sequence</code> loot function.|<code>all_of</code> predicates in loot tables can now be declared implicitly as an inline array without a type.}}
|{{HistoryLine||1.20.2|dev=23w32a|Added <code>sequence</code> loot function.
|{{HistoryLine||1.20.5|dev=24w07a|Added <code>gameplay/panda_sneeze</code> loot table for drops when [[Minecraft:panda]]s sneeze.}}
|<code>all_of</code> predicates in loot tables can now be declared implicitly as an inline array without a type.}}
|{{HistoryLine|||dev=24w09a|The <code>name</code> field for entry type <code>loot_table</code> has been renamed to <code>value</code> and now also accepts inline loot tables.}}
|{{HistoryLine||1.20.5|dev=24w09a|The <code>name</code> field for entry type <code>loot_table</code> has been renamed to <code>value</code> and now also accepts inline loot tables.}}
|{{HistoryLine|||dev=24w12a|Added <code>storage</code> loot number provider to access values from command storage.}}
|{{HistoryLine|||dev=24w12a|Added <code>storage</code> loot number provider to access values from command storage.}}
|{{HistoryLine||1.21|dev=24w18a
|{{HistoryLine||1.21|dev=24w18a|Score context target entities <code>killer</code>, <code>direct_killer</code>, <code>killer_player</code> were renamed to <code>attacker</code>, <code>direct_attacker</code>, <code>attacking_player</code>
|Score context target entities <code>killer</code>, <code>direct_killer</code>, <code>killer_player</code> were renamed to <code>attacker</code>, <code>direct_attacker</code>, <code>attacking_player</code>
|Added {{cd|enchantment_level}} number provider}}
|Added {{cd|enchantment_level}} number provider}}
|{{HistoryLine|||dev=24w21a|Moved loot tables from {{file|directory|loot_tables}} to {{file|directory|loot_table}}}}
|{{HistoryLine|||dev=24w21a|Moved loot tables from {{file|directory|loot_tables}} to {{file|directory|loot_table}}}}
|{{HistoryLine||1.21.2|dev=24w33a|Sheep shearing is now controlled by loot tables found as <code>shearing/sheep/{{ph|color}}</code>.|Mooshroom shearing is now controlled by loot tables found as <code>shearing/mooshroom/{{ph|variant}}</code>.|Snow golem shearing is now controlled by a loot table found as <code>shearing/snow_golem</code>.}}
|{{HistoryLine||1.21.2|dev=24w37a|The tool value (used for functions like <code>match_tool</code>) is now available for some additional loot table types.}}
|{{HistoryLine|||dev=24w35a|Special loot table empty has been removed and is no longer defined in vanilla data pack.|Sheep now always uses a single loot table <code>entities/sheep</code>.|Wool drops are still defined in sub-tables in <code>entities/sheep/{{ph|color}}</code>, but they are now just dispatched from the main table.|Sheep shearing is now controlled by loot table found as <code>shearing/sheep</code>.|Mooshroom shearing is now controlled by loot table found as <code>shearing/mooshroom</code>.}}
|{{HistoryLine||1.21.9|dev=25w31a|Added {{cd|minecraft:entity_interact}} and {{cd|minecraft:block_interact}} loot table types.
|{{HistoryLine|||dev=24w37a|Chickens laying eggs is now controlled by a loot table found at <code>gameplay/chicken_lay</code>.|Armadillos randomly dropping scutes is now controlled by a loot table found at <code>gameplay/armadillo_shed</code>.|The loot given by Villagers is now controlled by two additional loot tables: <code>gameplay/hero_of_the_village/unemployed_gift</code> and <code>gameplay/hero_of_the_village/baby_gift</code>.|The tool value (used for functions like <code>match_tool</code>) is now available for some additional loot table types.}}
|Fields that specify a target entity in a loot table, such as {{cd|entity_properties.entity}}, can additionally target the {{cd|target_entity}} and {{cd|interacting_entity}} parameter types.}}
|{{HistoryLine||1.21.9|dev=25w31a|Added {{cd|minecraft:entity_interact}} and {{cd|minecraft:block_interact}} loot table types.|Fields that specify a target entity in a loot table, such as {{cd|entity_properties.entity}}, can additionally target the {{cd|target_entity}} and {{cd|interacting_entity}} parameter types.|Added {{cd|charged_creeper/root}}, {{cd|brush/armadillo}}, {{cd|gameplay/turtle_grow}}, {{cd|harvest/beehive}}, {{cd|harvest/cave_vine}}, and {{cd|carve/pumpkin}} loot tables.}}
|{{HistoryLine||1.21.11|dev=25w44a|Added new {{cd|minecraft:slots}} loot pool entry.
|{{HistoryLine|||dev=25w32a|Added {{cd|harvest/sweet_berry_bush}} loot table.}}
|Removed {{cd|contents}} as a supported value for the {{cd|dynamic}} loot entry type.}}
|{{HistoryLine||1.21.11|dev=25w44a|Added new {{cd|minecraft:slots}} loot pool entry.|Removed {{cd|contents}} as a supported value for the {{cd|dynamic}} loot entry type.}}
|{{HistoryLine|||dev=25w46a|Reverted removal of {{cd|contents}} as a supported value for the {{cd|minecraft:dynamic}} loot pool entry.}}
|{{HistoryLine|||dev=25w46a|Reverted removal of {{cd|contents}} as a supported value for the {{cd|minecraft:dynamic}} loot pool entry.}}
|{{HistoryLine||26.1|dev=snap1|Added {{cd|minecraft:sum}} number provider.}}
|{{HistoryLine||26.1|dev=snap1|Added {{cd|minecraft:sum}} number provider.}}
|{{HistoryLine|||dev=pre1|Added {{cd|minecraft:environment_attribute}} number provider.}}
|{{HistoryLine|||dev=pre1|Added {{cd|minecraft:environment_attribute}} number provider.}}
|{{HistoryLine|upcoming java}}
|{{HistoryLine||26.3|dev=snap3|Added {{cd|minecraft:number_dispatcher}}, {{cd|minecraft:conditional_value}}, {{cd|minecraft:weighted_list}} number providers.}}
|{{HistoryLine|||dev=snap4|The {{cd|rolls}} and {{cd|bonus_rolls}} fields now accept an inline value or a namespaced ID of a {{cd|minecraft:number_provider}} type.|Loot table types that have a dedicated registry now support registry element and tag references.}}
}}
}}



Latest revision as of 11:10, 19 July 2026

Template:Exclusive

Loot tables are technical Minecraft: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 Minecraft:experience, or dropped non-item entities such as Minecraft:slimes from larger slimes or Minecraft:silverfish from infested blocks. In the Template:Cmd command, a loot table can be specified in Minecraft:SNBT format.

Definition

Loot tables are part of the data pack directory structure, highlighted below:

Template:Data pack directory

All loot tables are defined in data packs (vanilla data packs or custom data packs).

In the Template:Cmd command, a loot table can be specified in Minecraft:SNBT format.

Usage

Custom data packs use loot tables to change what loot can spawn in containers or drop by mobs. They can either modify existing loot tables or create new ones.

Vanilla usages

Vanilla loot tables are grouped into categories with some tables being in subfolders of those.

For example, the file for zombies would go in Template:File. Editing this file in a datapack would make every zombie in a Minecraft world use the modified datapack's loot table rather than the default zombie loot table.

To edit the loot tables of other entities, one would edit the entity's corresponding JSON file under the Template:File directory, which is typically said entity's name in the singular form (e.g. Template:File rather than Template:File).

The various subfolders and files include:

Some blocks, such as 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 some drops, such as the Minecraft:wither's Minecraft:nether star, are not covered by loot tables.<ref>Template:Bug</ref>

NBT data

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. Once there is an interaction with the container (e.g. opening or destroying), the two tags are removed, and loots appear in the container.

For Minecraft:barrel, Minecraft:chest, Minecraft:trapped chest, Minecraft:hopper, Minecraft:minecart with chest, Minecraft:boat with chest, Minecraft:minecart with hopper, Minecraft:dispenser, Minecraft:dropper, Minecraft:shulker box, dyed shulker box, and Minecraft:decorated pot:

For Minecraft:mobs:

Minecraft:Vaults use loot tables in their config to determine the items to eject when unlocking the vault, and items to display in the vault.

Minecraft:Trial spawners use loot tables in their vault configs to determine the items to give as reward, and the items used by ominous item spawners spawned during the active phase when ominous.

Minecraft:Monster spawners and trial spawners use loot tables to determine what equipment the spawned mobs have.

Others

Loot tables can be invoked directly by the Template:Cmd command.

Loot tables can also be invoked in advancement rewards.

Format

Loot tables are defined using Minecraft:JSON files stored within a Minecraft:data pack in the path Template:Cd.

In the Template:Cmd command, a loot table can be specified in Minecraft:SNBT format.

  • Template:Nbt The root.
    • Template:Nbt: (Optional. Defaults to generic) Specifies the Minecraft:loot context in which the loot table should be invoked. All item modifiers, predicates and number providers are then validated to ensure the parameters of the context type specified here cover all requirements, and prints a warning message in the output log if any modifier or predicate requires a context parameter that is not covered.
    • Template:Nbt: (Optional) Applies item modifiers in order, onto all item stacks dropped by this table.
    • Template:Nbt: (Optional) A list of all pools for this loot table. Pools are applied in order.
    • Template:Nbt: (Optional) A Minecraft:resource location specifying the name of the random sequence that is used to generate loot from this loot table. If only one loot table uses a specific random sequence, the order of the randomized sets of items generated is the same for every world using the same world seed. If multiple loot tables use the same random sequence, the loot generated from any one of them changes depending on how many times and in what order any of the other loot tables were invoked.

Pool

There are several entries in a pool. The number of rolls of a pool is specified by Template:Nbt and Template:NbtTemplate:Nbt). In each roll of a pool, the pool draws one entry from all its entries. Each roll of a pool is independent.

Entry

There are two types of loot entry: Singleton Entry and Composite Entry.

A singleton entry defines an item generating behavior that may generate zero, one or more item stacks. Every singleton entry has a weight. Each roll selects a weighted singleton entry from the pool.

Composite entries are not weighted entries to be rolled. Instead, they are expanded/flattened before rolling, i.e., some children entries in it are extracted out. If an extracted children entry is also a composite entry, it is further expanded until there are only singleton entries. Then, these singleton entries are added into the pool.

Once all composite entries have been expanded, there're only singleton entries in the pool. Then, singleton entries that do not meet their conditions (Template:Nbt field) are removed from the pool. After that, in the pool are only singleton entries that meet their conditions. Each singleton entry has a weight (defined by the Template:Nbt and Template:Nbt fields). The game randomly selects one weighted singleton entry from the pool as the result of a roll.

The tag entry is a special entry. Whether it is a singleton or composite entry is determined by the Template:Nbt field. If Template:Nbt is Template:Cd, it is a composite entry that expands into multiple singleton entries like item but do not apply item modifiers due to a bug<ref name="MC212671">Template:Bug</ref>.

The format of an entry is:

The possible values for Template:Nbt and associated extra fields are listed below.

Singleton entry

Fields common to all singleton entries:

    • Template:Nbt: (Optional) A list of predicates that must all pass for this singleton entry to be included into the pool. If any predicate is not satisfied, the singleton entry is removed from the pool before rolling.
    • Template:Nbt: (Optional) Applies item modifiers in order, onto all item stacks dropped by this singleton entry.
    • Template:Nbt: (Optional. Defaults to 1) Determines how often this singleton entry is chosen out of all the singleton entries in the pool. Entries with higher weights are used more often. The chance of an entry being chosen is [this entry's weight ÷ total weight of all entries in the pool].
    • Template:Nbt: (Optional. Defaults to 0) Modifies this singleton entry's Template:Cd based on the level of luck (including luck attribute and fishing_luck_bonus on fishing tool). Formula is Template:Cd. Due to known bugs, this does not work in some contexts<ref name="luck"/>.
    • Even more extra fields of the entry, described below.

Possible singleton entries:

  • loot_table — Drops the loot from another loot table.
  • empty — Drops nothing.

Tag entry

If Template:Nbt is Template:Cd, it is a singleton entry:

  • When selected in a roll, generates item stacks for all items in the specified item Minecraft:tag. The default, if not changed by item modifiers, each item stack is 1 item with its default Minecraft:data components.

If Template:Nbt is Template:Cd, it is a composite entry:

  • Expands into multiple singleton entries with the specified weight and conditions, for each item in the item Minecraft:tag. The item count of each item stack is 1, and each item is generated with its default Minecraft:data components. Item modifiers do not work<ref name="MC212671"/>.

Composite entry

Fields common to all composite entries:

    • Template:Nbt: (Optional) A list of predicates that must all pass for this composite entry to expand and its children to be added into the pool. If any predicate is not satisfied, the composite entry is ignored, so, no entry is added into the pool.
    • Template:Nbt: (Optional) The list of entries. Both singleton and composite entry are allowed.

Possible composite entries:

  • group — All entries in the Template:Nbt are extracted. Can be used for convenience, e.g. if one condition applies for multiple entries.
  • alternatives — Extracts only the first successful (conditions are met) entry. Conditions are checked in order.
  • sequence — Extracts the child entries in sequential order, continuing until an entry's conditions fail, then no more children are extracted.

Number provider

Template:Main Loot tables use number providers in some places that accept an Template:Nbt or Template:Nbt.

Loot context types

Template:Main The Template:Nbt field is used when loading the data pack to check whether the context parameters used by this loot table match the specified context type. The field makes it possible to check for errors in the loot table files without applying them in-game. If the loot table is used for a specific context, specifying the type field allows the game to check whether the loot table file uses parameters that are not provided in that context.

History

Individual tables

Template:HistoryTable

Relevant data

Unsorted

Template:HistoryTable

Issues

Template:Issue list

External links

References

Template:Reflist

Navigation

Template:Navbox Java Edition technical

Minecraft:de:Beutetabellen Minecraft:es:Tabla de botín Minecraft:fr:Table de butin Minecraft:ja:ルートテーブル Minecraft:ko:노획물 목록 Minecraft:nl:Buittabel Minecraft:pl:Tabela łupów Minecraft:pt:Tabela de itens Minecraft:ru:Таблицы добычи Minecraft:zh:战利品表