Loot tables

Loot tables are data-driven JSON files that decide what item stacks a block, entity, chest, fishing rod or command produces β€” built from pools, weighted entries, item-modifying functions, gating conditions and number providers.

File location

Each loot table is one JSON file under the singular 1.21+ folder:

data/<namespace>/loot_table/<path>.json

data/mypack/loot_table/blocks/lucky_ore.json     β†’ referenced as mypack:blocks/lucky_ore
data/mypack/loot_table/entity/boss_drop.json     β†’ referenced as mypack:entity/boss_drop

The table ID is namespace:path (without the .json). Vanilla tables live in the minecraft namespace and can be overridden by placing a same-named file in your pack.

Top-level schema

data/<namespace>/loot_table/example.json

{
  "type": "minecraft:block",
  "random_sequence": "minecraft:blocks/diamond_ore",
  "functions": [ /* table-wide item modifiers, applied to every dropped stack */ ],
  "pools": [ { /* pool */ } ]
}
FieldTypeMeaning
typestring (enum)The loot context the table is invoked in (optional, default generic). Validates which context parameters functions/conditions may reference. See the enum below.
poolsarrayList of pools; each pool is rolled independently.
functionsarrayTable-level item modifiers applied in order to every stack the whole table produces (shorthand for repeating functions in each pool).
random_sequenceresource locationNames a deterministic random sequence 1.20+ so per-table RNG is reproducible. Omit for fully random behaviour.

Loot context type enum

The context determines which parameters (the killed entity, the mined block, the tool, the origin position, etc.) are available to functions and conditions.

typeContext / provided parameters
emptyNo parameters.
genericSupplies all parameters (most permissive).
chestOrigin + opening entity.
blockBlock state, position, tool, explosion radius, (block entity, direct killer).
entityDying entity, position, damage source, (attacker / direct attacker / attacking player).
equipmentSpawned entity + position (mob equipment on spawn).
fishingBobber position, fishing rod tool, hooked-in entity.
archaeologySuspicious block center, brushing player, brush tool.
vaultVault center; optional opener entity + key item.
giftGiver location + gifting mob (cat/villager gifts).
barterThe piglin trading.
shearingSheared entity, position, shears tool.
advancement_rewardPlayer + location on advancement grant.
advancement_entityEntity + location (predicate/context use).
advancement_locationLocation context (predicate use).
command/loot and command-driven contexts.
selectorEntity-selector-driven contexts (predicates/item modifiers).
entity_interact / block_interactInteraction target + tool.
πŸ“Œ Note

Not every value is a valid loot-table-invoking context. Several (command, selector, advancement_entity, advancement_location, the interact types) primarily scope predicates and item modifiers rather than tables that drop items.

Pool schema

One entry in the pools array

{
  "rolls": 1,
  "bonus_rolls": 0.0,
  "conditions": [ /* all must pass or the pool is skipped */ ],
  "functions": [ /* applied to every stack from this pool */ ],
  "entries": [ /* one is chosen per roll (weighted) */ ]
}
FieldTypeMeaning
rollsnumber providerHow many entries to pick from this pool.
bonus_rollsnumber providerExtra rolls per level of luck (default 0.0).
entriesarrayCandidate entries; per roll one is selected by weight.
conditionsarrayAll must pass or the whole pool is skipped (see conditions).
functionsarrayItem modifiers applied to every stack from this pool (see functions).

Both rolls and bonus_rolls accept the full number-provider syntax β€” a plain number, a {min,max} uniform shorthand, or an explicit provider object (see below).

Entry types

Common entry fields: type, conditions, functions, plus for weighted (singleton) entries weight (default 1) and quality (default 0).

πŸ“Œ Note

Effective weight = max(floor(weight + quality Γ— luck), 0). A higher quality makes an entry more likely as the player's luck attribute rises.

typeKindKey fields
minecraft:itemsingletonname (item ID), functions, weight, quality.
minecraft:tagsingleton / expandingname (item #tag), expand (bool). expand:true = one entry per item in the tag (each weighted); expand:false = drops the whole tag's items as one entry.
minecraft:loot_tablesingletonvalue β€” a referenced table ID or an inline loot-table object (nested tables, 1.20.2+).
minecraft:dynamicsingletonname β€” context-supplied contents (minecraft:contents for block entities like shulker boxes; minecraft:sherds for decorated pots).
minecraft:emptysingletonDrops nothing (use for a weighted "chance of nothing").
minecraft:groupcompositechildren β€” evaluate all children as a unit.
minecraft:alternativescompositechildren β€” first child whose conditions pass (logical OR).
minecraft:sequencecompositechildren β€” run children in order until one's conditions fail (logical AND-until-fail).

Loot functions (full catalogue)

Every function object is {"function": "minecraft:<id>", ...params, "conditions": [...]} β€” conditions is optional on any function. This catalogue is identical to the standalone item modifier schema (an item-modifier file is just a reusable loot function or array of functions).

FunctionFields
set_countcount (number provider), add (bool, default false).
set_damagedamage (number provider), add (bool, default false).
set_componentscomponents (component map).
set_custom_datatag (SNBT string or object) β€” writes the custom_data component.
set_lorelore (array of text components), mode (append/insert/replace_all/replace_section), entity (ctx, optional), offset (int), size (int).
set_namename (text component), entity (ctx, optional), target (custom_name/item_name, default custom_name).
set_enchantmentsenchantments (map ID→level, each a number provider), add (bool).
enchant_randomlyoptions (array/#tag, optional), only_compatible (bool, default true).
enchant_with_levelslevels (number provider), options (optional).
enchanted_count_increaseenchantment (ID), count (number provider), limit (int, default 0). The looting_enchant replacement.
apply_bonusenchantment (ID), formula (uniform_bonus_count/ore_drops/binomial_with_bonus_count), parameters (extra/probability/bonusMultiplier).
furnace_smelt(none) β€” outputs the smelted form.
explosion_decay(none) β€” randomly removes items per explosion radius.
limit_countlimit (int, or {min,max} clamp).
set_attributesmodifiers (array of {attribute, id, amount(np), operation, slot}), replace (bool, default true).
set_stew_effecteffects (array of {type, duration}).
set_potionid (potion ID).
set_ominous_bottle_amplifieramplifier (number provider).
set_instrumentoptions (instrument #tag).
set_book_coverauthor, title (text component), generation (0–3) β€” all optional.
set_written_book_pages / set_writable_book_pagespages (array), mode, offset, size.
set_banner_patternpatterns (array), append (bool).
set_firework_explosionshape, colors (ints), fade_colors (ints), has_trail, has_twinkle.
set_fireworksexplosions (list op: values/mode/offset/size), flight_duration (0–255).
set_custom_model_datafloats/flags/strings/colors (each a list op) β€” structured CMD 1.21.4+.
set_contentsentries (array), component (container/bundle_contents/charged_projectiles).
modify_contentscomponent (container-like), modifier (item modifier(s) applied to contents).
set_loot_tablename (table ID), type (block-entity type), seed (optional) β€” for container block items.
set_itemitem (ID) β€” replaces the stack's item type.
copy_componentssource (block_entity), include/exclude (arrays, optional).
copy_custom_datasource (context/storage/block_entity), ops (array of {source, target, op}).
copy_namesource (context: block_entity/entity).
copy_stateblock (ID), properties (array of state names) β€” copies mined block states into block_state.
exploration_mapdestination (#tag), decoration, zoom (int, def 2), search_radius (int, def 50), skip_existing_chunks (bool, def true).
fill_player_headentity (ctx ref) β€” writes the profile of a player from context.
filtereditem_filter (item predicate), modifier (item modifier applied on match).
toggle_tooltipstoggles (booleans: attribute_modifiers, can_break, can_place_on, dyed_color, enchantments, stored_enchantments, trim, unbreakable).
set_random_dyes / set_random_potionRandomised dye / potion helpers.
referencename (referenced item-modifier ID or array).
sequencefunctions (array run in order).
πŸ“Œ Note

A bare array of functions in a loot functions list (or in an item-modifier file) behaves exactly like sequence.

Loot conditions (full list)

Every condition is {"condition": "minecraft:<id>", ...}. This is the same system as standalone predicate files β€” the full field breakdown of each condition lives on that page.

ConditionPurpose
all_ofterms β€” passes if all terms pass (AND).
any_ofterms β€” passes if any term passes (OR).
invertedterm β€” negates a single condition.
random_chancechance (float 0–1; a number provider since 1.21).
random_chance_with_enchanted_bonusLevel-scaled chance (1.21 rename of the old looting-based chance).
killed_by_playerRequires attacking_player in context.
entity_propertiesentity (context ref) + predicate (entity sub-predicate).
entity_scoresentity + scores (map objective β†’ int range).
block_state_propertyblock + properties (state map, exact or {min,max}).
table_bonusenchantment + chances (array indexed by level).
survives_explosionPasses with probability 1 / explosion_radius.
match_toolpredicate (item sub-predicate) β€” the mining/relevant tool.
weather_checkraining (bool), thundering (bool).
time_checkvalue (range) + period (int modulo, optional).
value_checkvalue (number provider) + range (int range).
location_checkpredicate (location sub-predicate) + optional offsetX/Y/Z.
damage_source_propertiespredicate (damage-source sub-predicate).
enchantment_active_checkactive (bool) β€” inside enchantment-provided effects.
referencename (resource location of another predicate file).

Number providers & ranges

Number providers generate a value for rolls, bonus_rolls, set_count.count, set_damage.damage, enchant levels, value_check, random_chance, and more. The four core providers are universal:

ProviderFieldsNotes
constantvalue (number)Fixed value.
uniformmin, max (each a number provider)Inclusive random.
binomialn (trials, np), p (probability 0–1, np)Binomial distribution.
scoretarget ({type:"fixed", name} or {type:"context", target}), score (objective), scale (float, optional)Reads a scoreboard value.
πŸ“Œ Note

Three further providers β€” storage (storage + path), enchantment_level (amount, a per-level value) and sum (summands array) β€” are documented but less common. The four above are the safe, universal set.

Shorthand forms

Int / float ranges

Distinct from number providers: a range tests a value rather than generating one. Used by predicate comparisons (count, distance, time_check.value, entity_scores, effects.amplifier, …). A range is a single number (exact match) or an object with optional min and/or max:

"count": { "min": 2, "max": 5 }     // 2..5 inclusive
"count": 3                           // exactly 3
"level": { "min": 10 }               // >= 10 (open upper bound)
"rolls": { "type": "minecraft:binomial", "n": 3, "p": 0.5 }
"count": { "type": "minecraft:score",
           "target": { "type": "context", "target": "this" },
           "score": "kills", "scale": 0.5 }

Examples

Block drop with a fortune bonus

data/mypack/loot_table/blocks/lucky_ore.json

{
  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:diamond",
          "functions": [
            {
              "function": "minecraft:apply_bonus",
              "enchantment": "minecraft:fortune",
              "formula": "minecraft:ore_drops"
            },
            { "function": "minecraft:explosion_decay" }
          ]
        }
      ],
      "conditions": [ { "condition": "minecraft:survives_explosion" } ]
    }
  ]
}

Weighted entity drop, gated on a player kill

data/mypack/loot_table/entity/boss_drop.json

{
  "type": "minecraft:entity",
  "pools": [
    {
      "rolls": { "min": 1, "max": 3 },
      "bonus_rolls": 0.5,
      "conditions": [ { "condition": "minecraft:killed_by_player" } ],
      "entries": [
        { "type": "minecraft:item", "name": "minecraft:diamond", "weight": 6,
          "functions": [ { "function": "minecraft:set_count",
                           "count": { "type": "minecraft:uniform", "min": 1, "max": 4 } } ] },
        { "type": "minecraft:item", "name": "minecraft:netherite_scrap", "weight": 1, "quality": 2 },
        { "type": "minecraft:empty", "weight": 3 }
      ]
    }
  ]
}

Chest / gift table (generic context)

data/mypack/loot_table/gameplay/enchanted_book_gift.json

{
  "type": "minecraft:generic",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:enchanted_book",
          "functions": [
            { "function": "minecraft:enchant_with_levels", "levels": { "min": 20, "max": 39 } }
          ]
        }
      ]
    }
  ]
}

A "custom item" drop via components 1.20.5+

data/mypack/loot_table/entity/starblade_drop.json

{
  "type": "minecraft:entity",
  "pools": [
    {
      "rolls": 1,
      "conditions": [ { "condition": "minecraft:killed_by_player" } ],
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:netherite_sword",
          "functions": [
            { "function": "minecraft:set_components",
              "components": {
                "minecraft:custom_name": "{\"text\":\"Starblade\",\"color\":\"gold\"}",
                "minecraft:rarity": "epic"
              } },
            { "function": "minecraft:set_custom_data", "tag": "{starblade:1b}" }
          ]
        }
      ]
    }
  ]
}

Tricks & best practices

🎩 Trick

/loot turns any table into a parametric item generator: /loot give @s loot mypack:x, /loot spawn ..., /loot replace block ..., /loot insert .... Call it from functions to hand out randomised kits without hard-coding /give lines.

πŸ’‘ Best practice

Use a weighted minecraft:empty entry for a "chance of nothing" inside a single roll, rather than a random_chance condition β€” it keeps the odds visible alongside the real drops.

πŸ’‘ Best practice

random_sequence guarantees reproducible RNG (deterministic chest loot for map-makers). Omit it when you want fully random behaviour.

🎩 Trick

Dynamic drops: a minecraft:dynamic entry (contents, sherds) emits the block's stored contents β€” required so shulker boxes and decorated pots keep their data when mined. Nested/inline tables (a loot_table entry with an inline value) plus reference functions/conditions keep shared sub-tables DRY.

πŸ“Œ Note

apply_bonus formulas: minecraft:uniform_bonus_count (param bonusMultiplier), minecraft:ore_drops (no params β€” the vanilla fortune ore curve), minecraft:binomial_with_bonus_count (params extra, probability).

Version differences

⚠ Version differences
  • Since 1.20.5 (pack_format 41): item NBT became data components. Loot items use component syntax and set_nbt was split into set_custom_data (the direct successor β€” writes the custom_data component) and the general set_components (sets any typed component).
  • Since 1.20.5: copy_nbt β†’ copy_custom_data.
  • Since 1.20.5: looting_enchant β†’ enchanted_count_increase (now takes an explicit enchantment, since looting is data-driven).
  • Since 1.21 (pack_format 48): the folder loot_tables was singularised to loot_table.
  • Since 1.21: loot-context entity refs renamed: killer β†’ attacker, direct_killer β†’ direct_attacker, killer_player β†’ attacking_player.
  • Since 1.21: random_chance_with_enchanted_bonus replaced the old looting-based random-chance condition, and random_chance's chance became a number provider.

Sources