Loot context
A loot context is a set of parameters available to loot tables, predicates, item modifiers, and number providers. As different uses have different available parameters, a loot context is used to determine if a given loot table or predicate is valid to that use case, allowing this check to be done when the data pack is loaded, rather than at runtime.
These loot context types are used in loot tables and can be set as the [String] type of a loot table.
These loot contexts cannot be set at type of a loot table. Instead, they are used for other invocation of predicates and item modifiers.
A loot context is a set of parameters available to loot tables, predicates, item modifiers, and number providers. As different uses have different available parameters, a loot context is used to determine if a given loot table or predicate is valid to that use case, allowing this check to be done when the data pack is loaded, rather than at runtime.
Loot context types and uses
Used in loot tables
These loot context types are used in loot tables and can be set as the [String] type of a loot table.
| Loot context type | When it is used | Loot context parameters that are supplied | Loot context parameters that may be supplied |
|---|---|---|---|
empty |
|
None | None |
chest |
|
|
|
fishing |
|
| |
entity |
|
|
|
equipment |
|
|
|
archaeology |
|
|
|
vault |
|
| |
gift |
|
|
|
barter |
|
|
|
advancement_reward |
|
|
|
generic |
|
N/A | N/A |
block |
|
|
|
shearing |
|
|
|
entity_interact |
|
| |
block_interact |
|
|
|
Only used in predicates
These loot contexts cannot be set at type of a loot table. Instead, they are used for other invocation of predicates and item modifiers.
| Loot context type | When it is used | Loot context parameters that are supplied | Loot context parameters that may be supplied |
|---|---|---|---|
command |
|
| |
selector |
|
|
|
advancement_entity |
|
|
|
advancement_location |
|
|
|
block_use |
|
|
|
enchanted_damage |
|
|
|
enchanted_item
|
|
||
enchanted_location
|
|
||
enchanted_entity
|
|
||
hit_block
|
|
||
villager_trade
|
Used for evaluating villager trades. |
|
Navigation
| |||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||