Loot Tables
Loot tables are JSON files that define what items should generate in many situations (container contents, mob/block drops, fishing, the loot command, and more). Kore provides a concise, type-safe DSL to build those tables programmatically.
For an introduction to the vanilla format, see the Minecraft Wiki entry Loot table.
Quick start
Table structure
- functions: Top-level list of item modifier functions (applied after pooling). Map to vanilla loot functions like
set_count
,enchant_randomly
, etc. See also the Components page’s “Patch items” note for runtime patching helpers. - pools: One or more
LootPool
s. - randomSequence: Optional
RandomSequenceArgument
for deterministic sequences. - type: Optional
LootTableType
(vanilla categories like blocks, entities, chests, fishing, etc.).
Pools
Each pool controls a roll and entry selection:
- rolls: A number provider indicating how many rolls to perform. Use providers like
constant(..)
or more advanced ones from the predicates providers package. - bonusRolls: An optional number provider added to rolls (commonly used with luck or looting effects when using conditions/functions).
- conditions: A list of predicate conditions guarding the pool. Refer to the Predicates guide for available conditions and composition (
allOf
,anyOf
, etc.). - entries: The actual things that can be selected (items, tags, alternatives, other loot tables, etc.).
- functions: Item modifier functions applied to items generated by this pool.
Minimal example:
Entries and functions
- Entries can be other loot tables, singleton items, or composites. Kore mirrors vanilla’s entry types in
features.loottables.entries
with idiomatic builders. - Functions are item modifiers. Common helpers include:
setCount(..)
enchantRandomly { options += Enchantments.* }
- Many others under
features.itemmodifiers.functions
Functions may also carry their own conditions { .. }
blocks to finely control when they apply.
Predicates (conditions)
Loot-table conditions use the same system as Kore’s general Predicates. You can attach them at the pool level, entry level, or function level. See the Predicates guide for the full catalog and patterns like randomChance(..)
, weatherCheck(..)
, entityProperties { .. }
, and more.
Refer to: Predicates (/docs/predicates
).
Full example with expected JSON
Produces JSON equivalent to:
Using with commands
You can pipe a table into the /loot
command via the DSL:
Full list of Loot-table helpers
Below is an alphabetical list of DSL helpers related to loot tables. Names match the builder functions or properties you use in code.
-
Top-level (table)
functions { .. }
lootTable(fileName, init)
pool(..) { .. }
randomSequence(..)
type(..)
-
Pool helpers
bonusRolls(..)
conditions(..)
/conditions { .. }
entries(..)
/entries { .. }
functions { .. }
rolls(..)
-
Entry types (use inside
entries { .. }
)alternative(children, conditions)
/alternate { .. }
dynamic(name) { .. }
empty(quality, weight)
group(children, conditions)
/group { .. }
item(name) { .. }
lootTable(name) { .. }
sequence(children, conditions)
/sequence { .. }
tag(name) { .. }
-
Entry helpers (per entry where applicable)
children { .. }
(foralternative
,group
,sequence
)conditions { .. }
functions { .. }
(foritem
,dynamic
, entrylootTable
,tag
)quality = ..
weight = ..
-
Providers and types
NumberProvider
(e.g.,constant(..)
)Predicate
/PredicateCondition
ItemModifier
(loot functions list used infunctions { .. }
)
-
Loot table types (
type = LootTableType.*
)ADVANCEMENT_ENTITY
ADVANCEMENT_LOCATION
ADVANCEMENT_REWARD
ARCHEOLOGY
BARTER
BLOCK
BLOCK_USE
CHEST
COMMAND
EMPTY
ENTITY
EQUIPMENT
FISHING
GIFT
GENERIC
SELECTOR
SHEARING
VAULT
Tips and best practices
- Keep pools narrowly focused and use multiple pools instead of complex single-pool logic.
- Prefer explicit
conditions
over embedding probabilities solely in functions for clarity. - Reuse common entry/function fragments by extracting helpers into functions to keep files short and readable.
Related docs
- Predicates:
/docs/predicates
- Advancements (rewards can point to loot tables):
/docs/advancements