Minecraft:Loot context: Difference between revisions
More actions
Sync: updated from Minecraft |
Sync: updated from Minecraft |
||
| Line 148: | Line 148: | ||
|- | |- | ||
| {{cd|command}} || | | {{cd|command}} || | ||
* Used | * Used to evaluate [[Minecraft:predicate]]s and [[Minecraft:item modifier]]s by commands such as {{cmd|item modify}} or {{cmd|execute (if{{!}}unless) predicate}}. | ||
| | | | ||
* '''Origin:''' The position where the command is run. | * '''Origin:''' The position where the command is run. | ||
| | | | ||
* '''{{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. | ||
|- | |||
| {{cd|command_compute_default}}{{upcoming|java 26.3}} || | |||
* Used to evaluate [[Minecraft:number provider]]s by {{command|compute default}}. | |||
| | |||
* '''Origin:''' The position where the command is run. | |||
| | |||
* '''{{cd|this}} entity:''' The entity that is {{cd|@s}} when the command is run. | |||
|- | |||
| {{cd|command_compute_entity}}{{upcoming|java 26.3}} || | |||
* Used to evaluate [[Minecraft:number provider]]s by {{command|compute entity}}. | |||
| | |||
* '''Origin:''' The position where the command is run. | |||
* '''{{cd|target_entity}}:''' The entity passed to {{command|compute entity}}. | |||
| | |||
* '''{{cd|this}} entity:''' The entity that is {{cd|@s}} when the command is run. | |||
|- | |||
| {{cd|command_compute_position}}{{upcoming|java 26.3}} || | |||
* Used to evaluate [[Minecraft:number provider]]s by {{command|compute block}}. | |||
| | |||
* '''Origin:''' The position where the command is run. | |||
* '''Block state:''' The current state of the block at the position passed to {{command|compute block}}. | |||
| | |||
* '''{{cd|this}} entity:''' The entity that is {{cd|@s}} when the command is run. | |||
* '''Block entity:''' The block entity of the block passed to {{command|compute block}}, if it was a block entity. | |||
|- | |- | ||
| {{cd|command_slot_source}}{{upcoming|java 26.3}} || | | {{cd|command_slot_source}}{{upcoming|java 26.3}} || | ||
* Used | * Used to evaluate [[Minecraft:slot sources]] by commands such as {{cmd|item}} or {{cmd|execute (if{{!}}unless) item}}. | ||
| | | | ||
* '''Origin:''' The position where the command is run. | * '''Origin:''' The position where the command is run. | ||
| Line 163: | Line 187: | ||
|- | |- | ||
| {{cd|selector}} || | | {{cd|selector}} || | ||
* Used | * Used by the {{cd|predicate}} [[Minecraft:Target selectors|target selector]] argument. | ||
| | | | ||
* '''Origin:''' The position of the entity being checked. | * '''Origin:''' The position of the entity being checked. | ||
| Line 170: | Line 194: | ||
|- | |- | ||
| {{cd|advancement_entity}} || | | {{cd|advancement_entity}} || | ||
* Used | * Used when an advancement invokes a predicate on an entity. | ||
| | | | ||
* '''{{cd|this}} entity:''' The entity being checked. | * '''{{cd|this}} entity:''' The entity being checked. | ||
| Line 177: | Line 201: | ||
|- | |- | ||
| {{cd|advancement_location}}|| | | {{cd|advancement_location}}|| | ||
* Used | * Used when an advancement invokes a predicate on the location of a block where an item was used on. | ||
| | | | ||
* '''{{cd|this}} entity:''' The player to gain the advancement. | * '''{{cd|this}} entity:''' The player to gain the advancement. | ||
| Line 187: | Line 211: | ||
|- | |- | ||
| {{cd|block_use}}|| | | {{cd|block_use}}|| | ||
* Used | * Used when an advancement invokes a predicate on {{cd|default_block_use}} trigger. | ||
| | | | ||
* '''{{cd|this}} entity:''' The player to gain the advancement. | * '''{{cd|this}} entity:''' The player to gain the advancement. | ||
| Line 195: | Line 219: | ||
|- | |- | ||
| {{cd|container_process}}{{upcoming|java 26.3}} || | | {{cd|container_process}}{{upcoming|java 26.3}} || | ||
* Used | * 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. | ||
| | | | ||
* '''Origin:''' The center of the workstation block. | * '''Origin:''' The center of the workstation block. | ||
Revision as of 11:15, 26 August 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:CdTemplate:Upcoming |
|
|
|
| Template:CdTemplate:Upcoming |
|
|
|
| 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:战利品上下文