Minecraft:Loot context: Difference between revisions
More actions
Sync: updated from Minecraft |
Sync: updated from Minecraft |
||
| Line 131: | Line 131: | ||
* 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}}. | * Tilling {{BlockLink|rooted dirt}}. | ||
| | | | ||
* '''Block state:''' The block that was interacted with. | * '''Block state:''' The block that was interacted with. | ||
* '''Origin:''' The center of the block that was interacted with. | * '''Origin:''' The center of the block that was interacted with. | ||
| | | | ||
* '''Block entity:''' Any block entity data of the block that was interacted with, if it is a block entity. | * '''Block entity:''' Any block entity data of the block that was interacted with, if it is a block entity. | ||
| Line 142: | Line 142: | ||
=== Not used in loot tables === | === Not used in loot tables === | ||
These loot contexts are not used to evaluate loot tables. Instead, they are used for other invocations of [[Minecraft:predicate]]s, [[Minecraft:item modifier]]s, [[Minecraft:slot sources]] | These loot contexts are not used to evaluate loot tables. Instead, they are used for other invocations of [[Minecraft:predicate]]s, [[Minecraft:item modifier]]s, [[Minecraft:slot sources]], and [[Minecraft:number provider]]s. | ||
{| class="wikitable" data-description="Invocation methods for predicates" | {| class="wikitable" data-description="Invocation methods for predicates" | ||
! scope="col" | Loot context type | ! scope="col" | Loot context type | ||
| Line 156: | Line 156: | ||
* '''{{cd|this}} entity:''' The entity that is {{cd|@s}} when the command is run. | * '''{{cd|this}} entity:''' The entity that is {{cd|@s}} when the command is run. | ||
|- | |- | ||
| {{cdanchor|minecraft:command_compute_default | | {{cdanchor|minecraft:command_compute_default}} || | ||
* Used to evaluate [[Minecraft:number provider]]s by {{command|compute default}}. | * Used to evaluate [[Minecraft:number provider]]s by {{command|compute default}}. | ||
| | | | ||
| Line 163: | Line 163: | ||
* '''{{cd|this}} entity:''' The entity that is {{cd|@s}} when the command is run. | * '''{{cd|this}} entity:''' The entity that is {{cd|@s}} when the command is run. | ||
|- | |- | ||
| {{cdanchor|minecraft:command_compute_entity | | {{cdanchor|minecraft:command_compute_entity}} || | ||
* Used to evaluate [[Minecraft:number provider]]s by {{command|compute entity}}. | * Used to evaluate [[Minecraft:number provider]]s by {{command|compute entity}}. | ||
| | | | ||
| Line 171: | Line 171: | ||
* '''{{cd|this}} entity:''' The entity that is {{cd|@s}} when the command is run. | * '''{{cd|this}} entity:''' The entity that is {{cd|@s}} when the command is run. | ||
|- | |- | ||
| {{cdanchor|minecraft:command_compute_position | | {{cdanchor|minecraft:command_compute_position}} || | ||
* Used to evaluate [[Minecraft:number provider]]s by {{command|compute block}}. | * Used to evaluate [[Minecraft:number provider]]s by {{command|compute block}}. | ||
| | | | ||
| Line 180: | Line 180: | ||
* '''Block entity:''' The block entity of the block passed to {{command|compute block}}, if it was a block entity. | * '''Block entity:''' The block entity of the block passed to {{command|compute block}}, if it was a block entity. | ||
|- | |- | ||
| {{cdanchor|minecraft:command_slot_source | | {{cdanchor|minecraft:command_slot_source}} || | ||
* Used to evaluate [[Minecraft:slot sources]] by commands such as {{cmd|item}} or {{cmd|execute (if{{!}}unless) item}}. | * Used to evaluate [[Minecraft:slot sources]] by commands such as {{cmd|item}} or {{cmd|execute (if{{!}}unless) item}}. | ||
| | | | ||
| Line 210: | Line 210: | ||
* '''Block state:''' The block that was interacted with. | * '''Block state:''' The block that was interacted with. | ||
| | | | ||
* '''Block entity:''' | * '''Block entity:''' Any block entity data of the block at the location, if it was a block entity. | ||
|- | |- | ||
| {{cdanchor|minecraft:block_use}}|| | | {{cdanchor|minecraft:block_use}}|| | ||
| Line 220: | Line 220: | ||
| | | | ||
|- | |- | ||
| {{cdanchor|minecraft:container_process | | {{cdanchor|minecraft:container_process}} || | ||
* Used by [[Minecraft:smelting]] blocks and [[Minecraft:brewing stand]]s to evaluate [[Minecraft:Data component format#cooking_fuel|{{cd|cooking_fuel}}]] and [[Minecraft:Data component format#brewing_fuel|{{cd|brewing_fuel}}]] respectively. | * Used by [[Minecraft:smelting]] blocks and [[Minecraft:brewing stand]]s to evaluate [[Minecraft:Data component format#cooking_fuel|{{cd|cooking_fuel}}]] and [[Minecraft:Data component format#brewing_fuel|{{cd|brewing_fuel}}]] respectively. | ||
| | | | ||
Latest revision as of 11:27, 16 September 2026
A loot context is a set of parameters available to Minecraft:loot tables, Minecraft:predicates, Minecraft:item modifiers, Minecraft:number providers, and Minecraft:slot sources.
When evaluating these data types in different situations, different parameters will be available. For example, a loot table that runs when the player mines a block would get a tool parameter if the player used an item to do it, but a loot table that populates a treasure chest would never get a tool parameter. Loot contexts are Minecraft:identifiers describing which parameters are available in specific situations. If one is set as the Template:Nbt of a loot table, it can be used to check whether the loot table depends on parameters that will never be available in its intended use case, allowing the game to report a problem when the Minecraft:data pack is loaded.
Loot context types and uses
Used for loot tables
These loot context types are used for evaluating Minecraft:loot tables, and other data types when they appear inside of loot tables.
| Loot context type | When it is used | Loot context parameters that are supplied | Loot context parameters that may be supplied |
|---|---|---|---|
| Template:Cdanchor |
|
None | None |
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
N/A | N/A |
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
Not used in loot tables
These loot contexts are not used to evaluate loot tables. Instead, they are used for other invocations of Minecraft:predicates, Minecraft:item modifiers, Minecraft:slot sources, and Minecraft:number providers.
| Loot context type | When it is used | Loot context parameters that are supplied | Loot context parameters that may be supplied |
|---|---|---|---|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
|
|
| Template:Cdanchor |
|
||
| Template:Cdanchor |
|
||
| Template:Cdanchor |
|
||
| Template:Cdanchor |
|
||
| Template:Cdanchor | 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:战利品上下文