Minecraft:Loot context: Difference between revisions
More actions
Sync: updated from Minecraft |
Sync: updated from Minecraft |
||
| Line 129: | Line 129: | ||
* Harvesting a {{BlockLink|beehive}}, {{BlockLink|cave vines}}, or {{BlockLink|sweet berry bush}} | * Harvesting a {{BlockLink|beehive}}, {{BlockLink|cave vines}}, or {{BlockLink|sweet berry bush}} | ||
* Carving a {{BlockLink|pumpkin}}. | * Carving a {{BlockLink|pumpkin}}. | ||
* | * Tilling {{BlockLink|rooted dirt}}.{{Upcoming|Java 26.3}} | ||
| | | | ||
* '''Block state:''' The block that was interacted with. | * '''Block state:''' The block that was interacted with. | ||
| Line 247: | Line 247: | ||
* '''Origin''': The position of the villager or wandering trader | * '''Origin''': The position of the villager or wandering trader | ||
* '''{{cd|this}} entity:''' The villager or wandering trader. | * '''{{cd|this}} entity:''' The villager or wandering trader. | ||
| | |||
* '''Additional cost component allowed''': Unit context. When present, causes the item modifier enchant_with_levels to generate the component {{DCL|additional_trade_cost}} on the item. | |||
|} | |} | ||
Revision as of 11:08, 27 July 2026
A loot context is a set of parameters available to Minecraft:loot tables, Minecraft:predicates, Minecraft:item modifiers, and Minecraft: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 Minecraft:loot tables and can be set as the Template:Nbt of a loot table.
| Loot context type | When it is used | Loot context parameters that are supplied | Loot context parameters that may be supplied |
|---|---|---|---|
| Template:Cd |
|
None | None |
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
N/A | N/A |
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
Only used in predicates
These loot contexts cannot be set at type of a loot table. Instead, they are used for other invocation of Minecraft:predicates, Minecraft:item modifiers, Minecraft:slot sourcesTemplate:Upcoming, and Minecraft:number providersTemplate:Upcoming.
| Loot context type | When it is used | Loot context parameters that are supplied | Loot context parameters that may be supplied |
|---|---|---|---|
| Template:Cd |
|
|
|
| Template:CdTemplate:Upcoming |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
|
|
| Template:CdTemplate:Upcoming |
|
|
|
| Template:Cd |
|
|
|
| Template:Cd |
|
||
| Template:Cd |
|
||
| Template:Cd |
|
||
| Template:Cd |
|
||
| Template:Cd | Used for evaluating villager trades. |
|
|
Template:Navbox Java Edition technical
Minecraft:de:Beutekontext Minecraft:fr:Contexte de butin Minecraft:ja:ルート文脈 Minecraft:pt:Contexto de saque Minecraft:zh:战利品上下文