![]() |
VOOZH | about |
Loot tables are technical 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 experience, or dropped non-item entities such as slimes from larger slimes or silverfish from infested blocks. In the /loot command, a loot table can be specified in SNBT format.
Loot tables are part of the data pack directory structure, highlighted below:
All loot tables are defined in data packs (vanilla data packs or custom data packs).
In the /loot command, a loot table can be specified in SNBT format.
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 loot tables are grouped into categories with some tables being in subfolders of those.
For example, the file for zombies would go in π File file.png: Sprite image for file in Minecraft
<data pack name>/data/minecraft/loot_table/entities/zombie.json. 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 π File directory.png: Sprite image for directory in Minecraft
<data pack name>/data/minecraft/loot_table/entities directory, which is typically said entity's name in the singular form (e.g. π File file.png: Sprite image for file in Minecraft
ghast.json rather than π File file.png: Sprite image for file in Minecraft
ghasts.json).
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 wither's nether star, are not covered by loot tables.[1]
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 barrel, chest, trapped chest, hopper, minecart with chest, boat with chest, minecart with hopper, dispenser, dropper, shulker box, dyed shulker box, and decorated pot:
loot_table field of the minecraft:container_loot component.0 or an omitted value causes the game to use a random seed. If set to 0, the tag is removed. Cannot exist unless the [String] LootTable tag is also present. Represents the seed field of the minecraft:container_loot component.For mobs:
Vaults use loot tables in their config to determine the items to eject when unlocking the vault, and items to display in the vault.
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.
Monster spawners and trial spawners use loot tables to determine what equipment the spawned mobs have.
Loot tables can be invoked directly by the /loot command.
Loot tables can also be invoked in advancement rewards.
Loot tables are defined using JSON files stored within a data pack in the path data/<namespace>/loot_table.
In the /loot command, a loot table can be specified in SNBT format.
generic) Specifies the 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.There are several entries in a pool. The number of rolls of a pool is specified by [NBT Compound / JSON Object] rolls and [Float][NBT Compound / JSON Object] bonus_rolls). In each roll of a pool, the pool draws one entry from all its entries. Each roll of a pool is independent.
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 ([NBT List / JSON Array] conditions 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 [Int] weight and [Int] quality 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 [Boolean] expand field. If [Boolean] expand is true, it is a composite entry that expands into multiple singleton entries like item but do not apply item modifiers due to a bug[3].
The format of an entry is:
The possible values for [String] type and associated extra fields are listed below.
Fields common to all singleton entries:
weight based on the level of luck (including luck attribute and fishing_luck_bonus on fishing tool). Formula is max(floor(weight + (quality Γ luck)),0). Due to known bugs, this does not work in some contexts[2].Possible singleton entries:
minecraft:diamond.contents which drops the items in a shulker box, or sherds which drops the sherds of a decorated pot. Does not work for other blocks.If [Boolean] expand is false, it is a singleton entry:
If [Boolean] expand is true, it is a composite entry:
minecraft:arrows.true, provides one singleton entry per item in the tag with the same weight and conditions. If false, it is a singleton entry that drops all items in the tag.weight based on the level of luck (including luck attribute and fishing_luck_bonus on fishing tool). Formula is max(floor(weight + (quality Γ luck)),0). This does not work in some context, due to bugs[2].Fields common to all composite entries:
Possible composite entries:
Loot tables use number providers in some places that accept an [Int] or [Float]. They can either be defined as a constant value or as an object.
Or:
Or:
The possible values for [String] type and associated extra contents:
fixed to manually specify a player name or UUID. Set to context to use an entity from loot context.fixed. Specifies the name of the player, or the entity's UUID (in hypenated hexadecimal format) whose score to query.context. Specifies an entity from loot context to query the score of. Can be this, attacker, direct_attacker, attacking_player, target_entity, or interacting_entity..The [String] type 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.
| Java Edition | |||||||
|---|---|---|---|---|---|---|---|
| 1.9 | 15w43a | β[more information needed] | |||||
| 15w43c | Renamed "villager_golem.json" to "iron_golem.json" | ||||||
| Added fishing loot tables, sheep without wool, and zombie and skeleton horses. | |||||||
| 1.9.1 | pre1 | Added default table chests/jungle_temple_dispenser. | |||||
| 1.14 | 18w43a | Block drops have been changed to use loot tables too.β[more information needed] | |||||
| 18w44a | Added loot tables for cats, cat_morning_gift, players and withers. | ||||||
| Added loot tables for new blocks. | |||||||
| 18w46a | Added loot table for illusioners. | ||||||
| 18w48a | Added more loot tables for villages, some of which are currently unused. | ||||||
| Removed loot table: village_blacksmith. | |||||||
| 18w49a | village_savanna_house and village_snowy_house loot tables are now used. | ||||||
| Added more loot tables for villages. | |||||||
| 18w50a | village_desert_house and village_taiga_house loot tables are now used, making all previously unused loot tables no longer unused. | ||||||
| ? | Empty loot table is now hardcoded. | ||||||
| 1.16 | ? | Fire and soul fire now have defined empty loot tables, rather than being hardcoded to drop nothing. | |||||
| ? | Nether portal blocks now have defined empty loot tables, rather than being hardcoded to drop nothing. | ||||||
| 1.20 | 23w17a | Added the loot table sniffer_digging. | |||||
| 1.20.5 | 24w07a | Added gameplay/panda_sneeze loot table for drops when pandas sneeze. | |||||
| 1.21.2 | 24w33a | Sheep shearing is now controlled by loot tables found as shearing/sheep/<color>.
| |||||
Mooshroom shearing is now controlled by loot tables found as shearing/mooshroom/<variant>.
| |||||||
Snow golem shearing is now controlled by a loot table found as shearing/snow_golem. | |||||||
| 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 entities/sheep.
| |||||||
Wool drops are still defined in sub-tables in entities/sheep/<color>, but they are now just dispatched from the main table.
| |||||||
Sheep shearing is now controlled by loot table found as shearing/sheep.
| |||||||
Mooshroom shearing is now controlled by loot table found as shearing/mooshroom. | |||||||
| 24w37a | Chickens laying eggs is now controlled by a loot table found at gameplay/chicken_lay.
| ||||||
Armadillos randomly dropping scutes is now controlled by a loot table found at gameplay/armadillo_shed.
| |||||||
The loot given by Villagers is now controlled by two additional loot tables: gameplay/hero_of_the_village/unemployed_gift and gameplay/hero_of_the_village/baby_gift. | |||||||
| 1.21.9 | 25w31a | Added charged_creeper/root, brush/armadillo, gameplay/turtle_grow, harvest/beehive, harvest/cave_vine, and carve/pumpkin loot tables. | |||||
| 25w32a | Added harvest/sweet_berry_bush loot table. | ||||||
| Java Edition | |||||||
|---|---|---|---|---|---|---|---|
| 1.9 | October 19, 2015 | Dinnerbone announces loot tables. | |||||
| 15w43a | Added loot tables. | ||||||
| 15w43b | Added condition entity_scores. | ||||||
| 15w43c | Renamed the tag [String] item: to [String] name:, and the tag [NBT Compound / JSON Object] items: to [NBT Compound / JSON Object] entries: | ||||||
| Added the tag [String] type: and support to load a loot table instead of an item. | |||||||
| Added the tag [Int] 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 [Int] quality tag. | ||||||
| Removed [Int] luck and [Float] luck_multiplier tags. | |||||||
| Added the [NBT Compound / JSON Object] bonus_rolls tag. | |||||||
| 15w51a | A player in spectator mode no longer triggers a container to use its loot table to generate loot. | ||||||
| 1.9.1 | pre1 | Loot tables now work with dispensers and droppers. | |||||
| 1.11 | 16w32a | Donkeys, mules, husks and zombie villagers 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. | ||||||
| 1.13 | 17w43a | Custom loot tables have been moved into data packs. | |||||
| 18w01a | Added the function set_name. | ||||||
| 1.14 | 18w43a | Loot tables received a bunch of new options.β[more information needed] | |||||
| Setting entity to "this" now refers to the player in chest and block loot tables. | |||||||
| 18w44a | Added the function set_lore. | ||||||
| 1.15 | 19w34a | Added the function copy_state. | |||||
| 1.16 | 20w12a | Added fishing_hook sub-predicate to check properties of the fishing hook. | |||||
| 1.20 | 23w12a | Added the shards dynamic drop. | |||||
| 23w14a | Added the function reference. | ||||||
| 23w17a | Renamed the shards dynamic drop to sherds. | ||||||
| pre1 | Made random sequences for loot tables deterministic. | ||||||
Added random_sequence field. | |||||||
| pre6 | The ID of the random sequence is now an optional field. | ||||||
| 1.20.2 | 23w32a | Added sequence loot function.
| |||||
all_of predicates in loot tables can now be declared implicitly as an inline array without a type. | |||||||
| 1.20.5 | 24w09a | The name field for entry type loot_table has been renamed to value and now also accepts inline loot tables. | |||||
| 24w12a | Added storage loot number provider to access values from command storage. | ||||||
| 1.21 | 24w18a | Score context target entities killer, direct_killer, killer_player were renamed to attacker, direct_attacker, attacking_player
| |||||
Added enchantment_level number provider | |||||||
| 24w21a | Moved loot tables from π File directory.png: Sprite image for directory in Minecraft loot_tables to π File directory.png: Sprite image for directory in Minecraft loot_table | ||||||
| 1.21.2 | 24w37a | The tool value (used for functions like match_tool) is now available for some additional loot table types. | |||||
| 1.21.9 | 25w31a | Added minecraft:entity_interact and minecraft:block_interact loot table types.
| |||||
Fields that specify a target entity in a loot table, such as entity_properties.entity, can additionally target the target_entity and interacting_entity parameter types. | |||||||
| 1.21.11 | 25w44a | Added new minecraft:slots loot pool entry.
| |||||
Removed contents as a supported value for the dynamic loot entry type. | |||||||
| 25w46a | Reverted removal of contents as a supported value for the minecraft:dynamic loot pool entry. | ||||||
| 26.1 | snap1 | Added minecraft:sum number provider. | |||||
| pre1 | Added minecraft:environment_attribute number provider. | ||||||
Issues relating to "Loot" are maintained on the bug tracker. Issues should be reported and viewed there.