Minecraft:Loot context: Difference between revisions
More actions
Sync: new page from Minecraft |
Sync: updated from Minecraft |
||
| Line 1: | Line 1: | ||
{{exclusive|java}} | {{exclusive|java}} | ||
A '''loot context''' is a set of parameters available to [[Minecraft:loot table]]s, [[Minecraft:predicate]]s, [[Minecraft:item modifier]]s, and number | A '''loot context''' is a set of parameters available to [[Minecraft:loot table]]s, [[Minecraft:predicate]]s, [[Minecraft:item modifier]]s, and [[Minecraft:number provider]]s. 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 == | == Loot context types and uses == | ||
| 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}}. | ||
* Till a {{BlockLink|rooted dirt}}.{{Upcoming|Java 26.3}} | |||
| | | | ||
* '''Block state:''' The block that was interacted with. | * '''Block state:''' The block that was interacted with. | ||
Revision as of 11:11, 18 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:战利品上下文