API reference / @jsprismarine/advancements
@jsprismarine/advancements
The Java Edition advancement engine. It parses advancement files once, links them into the parent tree, routes game events to the criteria listening for them, keeps per-player progress, and fires rewards through hooks a host supplies.
Conditions are not reimplemented here. Every entity, item, block, location, damage and fluid check inside a criterion is a loot condition compiled by @jsprismarine/predicates, which also owns 26.3's inline-or-id-or-list-or-tag composition rule. This package adds the 58 trigger types that the predicate package explicitly leaves out.
The grammar was read out of the Java 26.3 server jar: minecraft:trigger_type in reports/registries.json for the 58 ids, and the TriggerInstance records under net/minecraft/advancements/triggers/ for each one's fields. Parsing never throws; faults land in a DiagnosticCollector from the predicate package.
Install
pnpm add @jsprismarine/advancementsUsing it
import { AdvancementEngine, PlayerAdvancements, parseAdvancement } from '@jsprismarine/advancements';
const engine = new AdvancementEngine({
rewards: {
grantExperience: (player, amount) => player.addExperience(amount),
unlockRecipe: (player, recipe) => player.recipeBook.unlock(recipe)
}
});
engine.load(
[...definitions.advancements].flatMap(([id, json]) => {
const { value } = parseAdvancement(id, json, { resolver });
return value ? [value] : [];
})
);
const progress = new PlayerAdvancements();
const completed = engine.raise('placed_block', { player, origin, blockState, tool }, progress);definitions.advancements is what @jsprismarine/packs produces for a pack stack: the 1866 vanilla advancement files plus whatever the loaded datapacks add. resolver is the same ReferenceResolver the predicate package takes, and it is what lets a #tag inside a criterion or in rewards.loot expand.
The model
parseAdvancement(id, json, options) returns { value, diagnostics }, with value undefined only when the file has no usable criterion. The parsed shape follows the 26.3 file:
| Field | Shape | Default |
|---|---|---|
parent | namespaced id | absent, which makes the advancement a root |
display | icon, title, description, background, frame, showToast, announceToChat, hidden | absent; frame is task, the two announcement flags are true, hidden is false |
criteria | map from name to a trigger id and its compiled conditions | required and non-empty |
requirements | array of arrays of criterion names | one single-name group per criterion |
rewards | experience, lootTables, recipes, function | all empty |
sendsTelemetryEvent | boolean | false |
requirements is conjunctive normal form: every group must hold at least one completed criterion. The default that Java's AdvancementRequirements.allOf produces is therefore an and over all criteria, and a single-criterion file completes on that one criterion. Parsing reports a group that names no criterion of the file, a criterion that appears in no group, and an empty group.
buildAdvancementTree(advancements) resolves each parent into an AdvancementNode with its children. A parent that was not loaded reports and leaves the node a root. A parent chain that closes on itself reports at the first node whose walk revisits an id and detaches that node, which breaks the cycle and keeps the rest of the chain linked.
Titles and descriptions stay as parsed JSON. Turning a chat component into text belongs to the text layer, and the engine never reads them.
Triggers and coverage
All 58 registered types are implemented. Java spreads them over 29 TriggerInstance shapes, so the ids that read the same JSON share one parser here as well. Counts below are criteria across the 1866 vanilla files, measured by corpus.test.ts.
| Trigger | Vanilla criteria | Event |
|---|---|---|
inventory_changed | 1914 | InventoryEvent |
recipe_unlocked | 1739 | RecipeEvent |
player_killed_entity | 89 | KillEvent |
location | 67 | PlayerEvent |
consume_item | 41 | ItemEvent |
recipe_crafted | 27 | RecipeCraftedEvent |
bred_animals | 27 | BredAnimalsEvent |
tame_animal | 21 | EntityEvent |
placed_block | 15 | ItemUsedOnBlockEvent |
enter_block | 12 | BlockEvent |
item_used_on_block | 10 | ItemUsedOnBlockEvent |
player_generates_container_loot | 10 | ContainerLootEvent |
player_interacted_with_entity | 8 | PlayerInteractEvent |
filled_bucket | 6 | ItemEvent |
changed_dimension | 4 | ChangedDimensionEvent |
fishing_rod_hooked | 4 | FishingRodHookedEvent |
using_item, summoned_entity, player_hurt_entity, killed_by_arrow, effects_changed | 3 each | see events.ts |
villager_trade, thrown_item_picked_up_by_entity, construct_beacon | 2 each | |
| 30 further triggers | 1 each | |
used_ender_eye, voluntary_exile, default_block_use, any_block_use | 0 | implemented, unused by vanilla |
54 of the 58 appear in vanilla and 30 of those appear exactly once. The four with no vanilla criterion are implemented anyway, because a datapack can use them.
Three triggers need a note.
inventory_changed splits on how many item predicates it holds. Java tests a single predicate against the stack that changed and a list of several against the whole inventory, removing each predicate as a stack satisfies it. 1913 of the 1914 vanilla criteria take the single-predicate path, so InventoryEvent carries both inventory and changed. The slots counts are computed only when a criterion declares the field, which one vanilla criterion does.
killed_by_arrow needs a distinct victim per condition, channeled_lightning does not. Java removes a matched victim from the list in the first and not in the second, and the two behave differently when two conditions could match the same entity.
brewed_potion's potion field is a PotionsPredicate, which is 26.3's minecraft:potion_contents data component predicate. Rather than fork the component grammar, this package wraps the field into an item predicate and evaluates it against the brewed stack. The predicate package does not implement potion_contents yet, so such a field warns and evaluates false. No vanilla advancement writes it.
The event bus seam
engine.raise(trigger, event, progress) is the whole seam. TriggerEvents maps each trigger id to the event shape it listens for, so passing a BlockEvent to placed_block is a compile error. The engine builds the loot context each condition needs: advancement_entity for the player field and every other entity field, advancement_location for the location field of the placed_block family, and block_use for default_block_use and any_block_use.
Criteria are indexed by trigger, so an event touches only the criteria registered under it. The four triggers whose event names one registry element are indexed by that element as well:
| Trigger | Indexed by |
|---|---|
recipe_unlocked | each id in recipes |
recipe_crafted | each id in recipes |
crafter_recipe_crafted | each id in recipes |
player_generates_container_loot | each id in loot_tables |
The number that decides the cost is how many criteria one event evaluates, and engine.test.ts asserts it by counting draws from an injected random source. Against the whole vanilla corpus of 1866 advancements and 4045 criteria:
recipe_unlockedevaluates 1 criterion, not the 1739 that use the trigger. Raising all 1739 unlocks takes 8 to 30 ms on an Apple silicon laptop under Node 24, so 5 to 17 us per event.inventory_changedevaluates all 1914 criteria in its bucket, because no field of that trigger names a registry element to key on. One event takes 280 to 1140 us on the same machine, so roughly 0.15 to 0.6 us per criterion. This is the engine's worst dispatch.
Both wall-clock ranges come from repeated runs on a machine that was also building other packages, which is where the spread comes from; the criterion counts are exact.
Within one raise the engine builds each entity's predicate context once and reuses it, which is what keeps the per-criterion cost of the big bucket under a microsecond.
Progress
PlayerAdvancements is the per-player store. The engine takes one as an argument rather than owning it, so a server keeps progress wherever it keeps the rest of a player's data.
progress.grant('minecraft:story/mine_stone', 'get_stone');
progress.hasCriterion('minecraft:story/mine_stone', 'get_stone'); // true
progress.isDone(engine.get('minecraft:story/mine_stone')!); // true
progress.revokeCriterion('minecraft:story/mine_stone', 'get_stone');
progress.revoke('minecraft:story/mine_stone');toJSON produces a plain object a server can persist as is, and fromJSON reads it back:
{
"minecraft:story/mine_stone": {
"criteria": { "get_stone": "2026-10-25T09:14:02.511Z" },
"done": true
}
}Instants are ISO-8601 rather than Java's yyyy-MM-dd HH:mm:ss Z, because nothing here reads a Java player data file and Date.parse round-trips ISO-8601 without a format string. grant takes an explicit instant, so a test or a migration decides its own clock.
fromJSON ignores the stored done flag and recomputes completion from the advancement's current requirements. A datapack reload that changes requirements therefore re-derives whether a player has finished, instead of trusting a flag written against the old matrix.
Reward hooks
Every hook is optional, and a reward with no hook reports a warning instead of failing the completion, so a server can ship advancements before it has every subsystem.
new AdvancementEngine({
rewards: {
grantExperience: (player, amount) => {},
runLootTable: (player, lootTable) => {},
unlockRecipe: (player, recipe) => {},
runFunction: (player, id) => {}
}
});runFunction is the seam @jsprismarine/mcfunction fills; nothing in this package depends on it. Rewards fire once, when the advancement completes, from either raise or award. Vanilla uses recipes on 1739 files and experience on 23, and uses neither loot nor function.
Corpus test
corpus.test.ts parses the real Java 26.3 vanilla advancements out of the cached server jar and asserts the grammar reports nothing, neither errors nor warnings. It measures 1866 files, 4045 criteria, 54 used triggers, 6 roots and no parent cycle, and it pins the per-trigger counts in the table above. It needs the cache that pnpm --filter @jsprismarine/bedrock-data run fetch:sources populates, so it only runs with JSP_VANILLA_DATAPACK set and CI without the cache skips it.
License
MIT
Classes
Interfaces
AdvancementDisplay
Defined in: model.ts:34
What a client draws for an advancement in the tab and in the toast.
Properties
announceToChat
readonlyannounceToChat:boolean
Defined in: model.ts:43
background?
readonlyoptionalbackground?:string
Defined in: model.ts:40
Background texture of a root advancement's tab, absent on every non-root.
description
readonlydescription:unknown
Defined in: model.ts:38
frame
readonlyframe:"task"|"challenge"|"goal"
Defined in: model.ts:41
hidden
readonlyhidden:boolean
Defined in: model.ts:44
icon
readonlyicon:AdvancementIcon
Defined in: model.ts:35
showToast
readonlyshowToast:boolean
Defined in: model.ts:42
title
readonlytitle:unknown
Defined in: model.ts:37
Chat component JSON; turning it into text belongs to the text package, not here.
AdvancementEngineOptions
Defined in: engine.ts:36
The world views and hooks an engine evaluates and rewards through.
Properties
content?
optionalcontent?:ContentView
Defined in: engine.ts:40
diagnostics?
optionaldiagnostics?:DiagnosticCollector
Defined in: engine.ts:43
Reuse a collector to gather load faults and evaluation faults into one report.
enchantments?
optionalenchantments?:EnchantmentView
Defined in: engine.ts:39
items?
optionalitems?:ItemStackOps
Defined in: engine.ts:38
level?
optionallevel?:LevelView
Defined in: engine.ts:37
random?
optionalrandom?:RandomSource
Defined in: engine.ts:41
rewards?
optionalrewards?:RewardHooks
Defined in: engine.ts:44
AdvancementIcon
Defined in: model.ts:25
The stack template an advancement draws as its icon.
Properties
components?
readonlyoptionalcomponents?:unknown
Defined in: model.ts:30
Data components as parsed JSON, because only the client reads them.
count
readonlycount:number
Defined in: model.ts:28
id
readonlyid:string
Defined in: model.ts:27
Namespaced item identifier.
AdvancementNode
Defined in: tree.ts:7
One advancement in the tree, with its resolved parent and children.
Properties
advancement
readonlyadvancement:ParsedAdvancement
Defined in: tree.ts:9
children
readonlychildren: readonlyAdvancementNode[]
Defined in: tree.ts:12
id
readonlyid:string
Defined in: tree.ts:8
parent?
readonlyoptionalparent?:AdvancementNode
Defined in: tree.ts:11
Absent on a root, and on a node whose parent could not be resolved.
AdvancementProgressJson
Defined in: progress.ts:22
One advancement's stored progress, as a server persists it.
Properties
criteria
readonlycriteria:Readonly<Record<string,string>>
Defined in: progress.ts:24
Criterion name to the ISO-8601 instant it was completed at.
done
readonlydone:boolean
Defined in: progress.ts:25
AdvancementProgressView
Defined in: progress.ts:32
How far a player is through one advancement.
Properties
completed
readonlycompleted:number
Defined in: progress.ts:37
Satisfied requirement groups out of the advancement's total.
criteria
readonlycriteria:ReadonlyMap<string,string>
Defined in: progress.ts:34
Completed criterion names with the instant each was completed at.
done
readonlydone:boolean
Defined in: progress.ts:35
total
readonlytotal:number
Defined in: progress.ts:38
AdvancementRewards
Defined in: model.ts:48
What completing an advancement hands the player.
Properties
experience
readonlyexperience:number
Defined in: model.ts:49
function?
readonlyoptionalfunction?:string
Defined in: model.ts:55
Namespaced identifier of an mcfunction to run.
lootTables
readonlylootTables: readonlystring[]
Defined in: model.ts:51
Namespaced loot table identifiers, with any #tag already expanded.
recipes
readonlyrecipes: readonlystring[]
Defined in: model.ts:53
Namespaced recipe identifiers to unlock.
AdvancementTree
Defined in: tree.ts:16
Every advancement, linked by parent.
Properties
nodes
readonlynodes:ReadonlyMap<string,AdvancementNode>
Defined in: tree.ts:19
roots
readonlyroots: readonlyAdvancementNode[]
Defined in: tree.ts:18
Nodes with no parent, in the order the advancements were given.
BeaconEvent
Defined in: events.ts:96
A beacon the player completed.
Extends
Properties
level
readonlylevel:number
Defined in: events.ts:98
Number of complete pyramid layers under the beacon.
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
BeeNestDestroyedEvent
Defined in: events.ts:208
A bee nest or beehive the player broke.
Extends
Properties
beesInside
readonlybeesInside:number
Defined in: events.ts:212
blockState
readonlyblockState:BlockState
Defined in: events.ts:209
item
readonlyitem:ItemStack
Defined in: events.ts:211
The stack used to break it.
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
BlockEvent
Defined in: events.ts:37
A block a player entered or slid down.
Extends
Properties
blockState
readonlyblockState:BlockState
Defined in: events.ts:38
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
BlockInteractionEvent
Defined in: events.ts:162
A block the player right-clicked, without the item in hand.
Extends
Properties
blockState
readonlyblockState:BlockState
Defined in: events.ts:164
origin
readonlyorigin:Vec3
Defined in: events.ts:163
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
BredAnimalsEvent
Defined in: events.ts:108
Two animals that bred.
Extends
Properties
child?
readonlyoptionalchild?:EntityView
Defined in: events.ts:112
Absent when the breeding produced no child, as mule breeding can.
parent
readonlyparent:EntityView
Defined in: events.ts:109
partner
readonlypartner:EntityView
Defined in: events.ts:110
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
BrewedPotionEvent
Defined in: events.ts:90
A potion a brewing stand finished for the player.
Extends
Properties
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
potion
readonlypotion:ItemStack
Defined in: events.ts:92
The brewed stack, whose minecraft:potion_contents the potion field reads.
ChangedDimensionEvent
Defined in: events.ts:145
A dimension change.
Extends
Properties
from
readonlyfrom:string
Defined in: events.ts:147
Namespaced dimension identifier the player left.
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
to
readonlyto:string
Defined in: events.ts:149
Namespaced dimension identifier the player arrived in.
CompiledCriterion
Defined in: model.ts:64
One compiled criterion. test declares the union of every event shape because compiling erases which trigger produced it; the engine only ever calls it with the event its own trigger declares, and method syntax is what makes that assignment typecheck.
Properties
keys?
readonlyoptionalkeys?: readonlystring[]
Defined in: model.ts:72
Registry ids this criterion can match, for the triggers KEYED_TRIGGERS covers. The engine indexes by them instead of putting the criterion in its trigger's linear bucket.
name
readonlyname:string
Defined in: model.ts:65
trigger
readonlytrigger:"villager_trade"|"enchanted_item"|"impossible"|"player_killed_entity"|"entity_killed_player"|"enter_block"|"inventory_changed"|"recipe_unlocked"|"player_hurt_entity"|"entity_hurt_player"|"filled_bucket"|"brewed_potion"|"construct_beacon"|"used_ender_eye"|"summoned_entity"|"bred_animals"|"location"|"slept_in_bed"|"cured_zombie_villager"|"item_durability_changed"|"levitation"|"changed_dimension"|"tick"|"tame_animal"|"placed_block"|"consume_item"|"effects_changed"|"used_totem"|"nether_travel"|"fishing_rod_hooked"|"channeled_lightning"|"shot_crossbow"|"spear_mobs"|"killed_by_arrow"|"hero_of_the_village"|"voluntary_exile"|"slide_down_block"|"bee_nest_destroyed"|"target_hit"|"item_used_on_block"|"default_block_use"|"any_block_use"|"player_generates_container_loot"|"thrown_item_picked_up_by_entity"|"thrown_item_picked_up_by_player"|"player_interacted_with_entity"|"player_sheared_equipment"|"started_riding"|"lightning_strike"|"using_item"|"fall_from_height"|"ride_entity_in_lava"|"kill_mob_near_sculk_catalyst"|"allay_drop_item_on_block"|"avoid_vibration"|"recipe_crafted"|"crafter_recipe_crafted"|"fall_after_explosion"
Defined in: model.ts:66
Methods
test()
test(
event,services):boolean
Defined in: model.ts:73
Parameters
event
services
Returns
boolean
ContainerLootEvent
Defined in: events.ts:223
A container whose loot the player generated.
Extends
Properties
lootTable
readonlylootTable:string
Defined in: events.ts:225
Namespaced loot table identifier.
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
CuredZombieVillagerEvent
Defined in: events.ts:116
A zombie villager a player cured.
Extends
Properties
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
villager
readonlyvillager:EntityView
Defined in: events.ts:118
zombie
readonlyzombie:EntityView
Defined in: events.ts:117
DamageEvent
Defined in: events.ts:64
Damage the player took.
Extends
Extended by
Properties
blocked
readonlyblocked:boolean
Defined in: events.ts:70
damageSource
readonlydamageSource:DamageSource
Defined in: events.ts:65
dealt
readonlydealt:number
Defined in: events.ts:67
Damage before armor, resistance and enchantments reduced it.
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
taken
readonlytaken:number
Defined in: events.ts:69
Damage that reached the health bar.
EffectsChangedEvent
Defined in: events.ts:168
A change to the player's status effects.
Extends
Properties
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
source?
readonlyoptionalsource?:EntityView
Defined in: events.ts:170
The entity that applied the effect, such as the shooter of a tipped arrow.
EnchantedItemEvent
Defined in: events.ts:84
An item that came out of an enchanting table.
Extends
Properties
item
readonlyitem:ItemStack
Defined in: events.ts:80
Inherited from
levels
readonlylevels:number
Defined in: events.ts:86
Experience levels the enchantment cost.
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
EnderEyeEvent
Defined in: events.ts:102
An eye of ender thrown toward a stronghold.
Extends
Properties
distance
readonlydistance:number
Defined in: events.ts:104
Horizontal distance in blocks from the player to the stronghold.
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
EntityEvent
Defined in: events.ts:26
An event about one other entity, such as the animal a player tamed.
Extends
Extended by
Properties
entity
readonlyentity:EntityView
Defined in: events.ts:27
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
EvaluationServices
Defined in: events.ts:254
The world-facing views a trigger needs while it evaluates its conditions. Every member except the collector is optional and mirrors the matching seam on @jsprismarine/predicates; a condition that reaches a view the host left out reports a diagnostic and evaluates false.
Properties
content?
readonlyoptionalcontent?:ContentView
Defined in: events.ts:259
contexts?
readonlyoptionalcontexts?:Map<EntityView,PredicateContext>
Defined in: events.ts:269
Memo for entityContext, which the engine refreshes for each event it raises. One event reaches every criterion registered under its trigger, and the biggest vanilla bucket holds 1914 of them, so building the player's context once instead of once per criterion is the difference the memo makes. Leave it out and each call builds a fresh context.
diagnostics
readonlydiagnostics:DiagnosticCollector
Defined in: events.ts:255
enchantments?
readonlyoptionalenchantments?:EnchantmentView
Defined in: events.ts:258
items?
readonlyoptionalitems?:ItemStackOps
Defined in: events.ts:257
level?
readonlyoptionallevel?:LevelView
Defined in: events.ts:256
random?
readonlyoptionalrandom?:RandomSource
Defined in: events.ts:260
FallAfterExplosionEvent
Defined in: events.ts:179
A fall that an explosion started.
Extends
Properties
cause?
readonlyoptionalcause?:EntityView
Defined in: events.ts:180
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
startPosition
readonlystartPosition:Vec3
Defined in: events.ts:175
Inherited from
FishingRodHookedEvent
Defined in: events.ts:184
A fishing bobber that caught something.
Extends
Properties
entity?
readonlyoptionalentity?:EntityView
Defined in: events.ts:187
The hooked entity, absent when the bobber caught loot out of open water.
items
readonlyitems: readonlyItemStack[]
Defined in: events.ts:189
The stacks the catch produced.
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
rod
readonlyrod:ItemStack
Defined in: events.ts:185
InventoryEvent
Defined in: events.ts:45
An inventory change. Java tests a single-item criterion against changed alone and a multi-item one against the whole inventory, so both are here.
Extends
Properties
changed?
readonlyoptionalchanged?:ItemStack
Defined in: events.ts:49
The stack that changed, or undefined when the change emptied the slot.
inventory
readonlyinventory: readonly (ItemStack|undefined)[]
Defined in: events.ts:47
Every slot in order, with an empty slot as undefined.
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
ItemDurabilityEvent
Defined in: events.ts:129
Durability a tool lost or regained.
Extends
Properties
delta
readonlydelta:number
Defined in: events.ts:133
Durability lost, negative when the item was repaired.
durability
readonlydurability:number
Defined in: events.ts:131
Durability left after the change.
item
readonlyitem:ItemStack
Defined in: events.ts:80
Inherited from
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
ItemEvent
Defined in: events.ts:79
An event about one stack, such as the item a player ate.
Extends
Extended by
Properties
item
readonlyitem:ItemStack
Defined in: events.ts:80
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
ItemUsedOnBlockEvent
Defined in: events.ts:153
An item used against a block, which is also how a placed block is reported.
Extends
Properties
blockEntity?
readonlyoptionalblockEntity?:BlockEntityView
Defined in: events.ts:158
blockState
readonlyblockState:BlockState
Defined in: events.ts:155
origin
readonlyorigin:Vec3
Defined in: events.ts:154
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
tool
readonlytool:ItemStack
Defined in: events.ts:157
The stack in hand, which the match_tool condition reads.
KillEvent
Defined in: events.ts:31
A death, raised once for the killer and once for the victim.
Extends
Properties
damageSource?
readonlyoptionaldamageSource?:DamageSource
Defined in: events.ts:33
The blow that killed, read by player_killed_entity's killing_blow.
entity
readonlyentity:EntityView
Defined in: events.ts:27
Inherited from
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
KilledByArrowEvent
Defined in: events.ts:198
Entities killed by one arrow.
Extends
Properties
firedFromWeapon?
readonlyoptionalfiredFromWeapon?:ItemStack
Defined in: events.ts:199
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
victims
readonlyvictims: readonlyEntityView[]
Defined in: events.ts:194
Inherited from
LevitationEvent
Defined in: events.ts:137
A player carried upward by levitation.
Extends
Properties
duration
readonlyduration:number
Defined in: events.ts:141
Remaining effect duration in ticks.
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
startPosition
readonlystartPosition:Vec3
Defined in: events.ts:139
Where the levitation started, which the distance field measures from.
LightningStrikeEvent
Defined in: events.ts:242
A lightning bolt that struck near the player.
Extends
Properties
bystanders
readonlybystanders: readonlyEntityView[]
Defined in: events.ts:245
Every entity within range of the strike.
lightning
readonlylightning:EntityView
Defined in: events.ts:243
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
ParsedAdvancement
Defined in: model.ts:77
One advancement file, parsed once and compiled.
Properties
criteria
readonlycriteria:ReadonlyMap<string,CompiledCriterion>
Defined in: model.ts:84
display?
readonlyoptionaldisplay?:AdvancementDisplay
Defined in: model.ts:82
id
readonlyid:string
Defined in: model.ts:79
Namespaced identifier, which is the file path under data/<namespace>/advancement/.
parent?
readonlyoptionalparent?:string
Defined in: model.ts:81
Namespaced identifier of the parent, absent on a root.
requirements
readonlyrequirements: readonly (readonlystring[])[]
Defined in: model.ts:91
Conjunctive normal form over the criterion names: the advancement completes when every group has at least one completed criterion. An absent requirements becomes one single-name group per criterion, which is Java's AdvancementRequirements.allOf.
rewards
readonlyrewards:AdvancementRewards
Defined in: model.ts:83
sendsTelemetryEvent
readonlysendsTelemetryEvent:boolean
Defined in: model.ts:92
PickedUpItemEvent
Defined in: events.ts:229
A thrown item picked up, raised for the thrower and for the receiver.
Extends
Properties
entity?
readonlyoptionalentity?:EntityView
Defined in: events.ts:232
The other party: the entity that picked the item up, or the one that threw it.
item
readonlyitem:ItemStack
Defined in: events.ts:230
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
PlayerEvent
Defined in: events.ts:21
What every advancement event carries. player is the subject of the player field that all 57 non-impossible triggers accept.
Extended by
EntityEventBlockEventInventoryEventRecipeEventDamageEventItemEventBrewedPotionEventBeaconEventEnderEyeEventBredAnimalsEventCuredZombieVillagerEventVillagerTradeEventLevitationEventChangedDimensionEventItemUsedOnBlockEventBlockInteractionEventEffectsChangedEventTravelEventFishingRodHookedEventVictimsEventSpearMobsEventBeeNestDestroyedEventTargetHitEventContainerLootEventPickedUpItemEventPlayerInteractEventLightningStrikeEvent
Properties
player
readonlyplayer:EntityView
Defined in: events.ts:22
PlayerHurtEntityEvent
Defined in: events.ts:74
Damage the player dealt to another entity.
Extends
Properties
blocked
readonlyblocked:boolean
Defined in: events.ts:70
Inherited from
damageSource
readonlydamageSource:DamageSource
Defined in: events.ts:65
Inherited from
dealt
readonlydealt:number
Defined in: events.ts:67
Damage before armor, resistance and enchantments reduced it.
Inherited from
entity
readonlyentity:EntityView
Defined in: events.ts:75
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
taken
readonlytaken:number
Defined in: events.ts:69
Damage that reached the health bar.
Inherited from
PlayerInteractEvent
Defined in: events.ts:236
A player interacting with an entity using the item in hand.
Extends
Properties
entity
readonlyentity:EntityView
Defined in: events.ts:238
item
readonlyitem:ItemStack
Defined in: events.ts:237
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
RecipeCraftedEvent
Defined in: events.ts:59
A recipe the player or a crafter finished, with the stacks it consumed.
Extends
Properties
ingredients
readonlyingredients: readonlyItemStack[]
Defined in: events.ts:60
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
recipe
readonlyrecipe:string
Defined in: events.ts:55
Namespaced recipe identifier.
Inherited from
RecipeEvent
Defined in: events.ts:53
A recipe the player unlocked.
Extends
Extended by
Properties
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
recipe
readonlyrecipe:string
Defined in: events.ts:55
Namespaced recipe identifier.
RewardHooks
Defined in: engine.ts:26
Where the four reward kinds land. Every hook is optional, and a reward with no hook reports a diagnostic rather than failing the completion, so a server can ship advancements before it has a loot runner or a function runtime. The function hook is the seam @jsprismarine/mcfunction fills.
Methods
grantExperience()?
optionalgrantExperience(player,amount):void
Defined in: engine.ts:28
Adds experience points, not levels, which is what rewards.experience counts.
Parameters
player
amount
number
Returns
void
runFunction()?
optionalrunFunction(player,id):void
Defined in: engine.ts:32
Parameters
player
id
string
Returns
void
runLootTable()?
optionalrunLootTable(player,lootTable):void
Defined in: engine.ts:30
Rolls a loot table and gives the player what it produced.
Parameters
player
lootTable
string
Returns
void
unlockRecipe()?
optionalunlockRecipe(player,recipe):void
Defined in: engine.ts:31
Parameters
player
recipe
string
Returns
void
SpearMobsEvent
Defined in: events.ts:203
Mobs a thrown trident pinned at once.
Extends
Properties
count
readonlycount:number
Defined in: events.ts:204
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
TargetHitEvent
Defined in: events.ts:216
A target block a projectile hit.
Extends
Properties
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
projectile
readonlyprojectile:EntityView
Defined in: events.ts:219
signalStrength
readonlysignalStrength:number
Defined in: events.ts:218
Redstone signal the hit produced, 0 to 15.
TravelEvent
Defined in: events.ts:174
Travel measured from where it started, for nether_travel and the two fall triggers.
Extends
Extended by
Properties
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
startPosition
readonlystartPosition:Vec3
Defined in: events.ts:175
TriggerEvents
Defined in: triggers.ts:141
Which event shape each trigger listens for. A host raises one of these and the engine routes it to the criteria registered under that trigger.
Properties
allay_drop_item_on_block
allay_drop_item_on_block:
ItemUsedOnBlockEvent
Defined in: triggers.ts:195
any_block_use
any_block_use:
BlockInteractionEvent
Defined in: triggers.ts:183
avoid_vibration
avoid_vibration:
PlayerEvent
Defined in: triggers.ts:196
bee_nest_destroyed
bee_nest_destroyed:
BeeNestDestroyedEvent
Defined in: triggers.ts:179
bred_animals
bred_animals:
BredAnimalsEvent
Defined in: triggers.ts:156
brewed_potion
brewed_potion:
BrewedPotionEvent
Defined in: triggers.ts:152
changed_dimension
changed_dimension:
ChangedDimensionEvent
Defined in: triggers.ts:163
channeled_lightning
channeled_lightning:
VictimsEvent
Defined in: triggers.ts:172
construct_beacon
construct_beacon:
BeaconEvent
Defined in: triggers.ts:153
consume_item
consume_item:
ItemEvent
Defined in: triggers.ts:167
crafter_recipe_crafted
crafter_recipe_crafted:
RecipeCraftedEvent
Defined in: triggers.ts:198
cured_zombie_villager
cured_zombie_villager:
CuredZombieVillagerEvent
Defined in: triggers.ts:159
default_block_use
default_block_use:
BlockInteractionEvent
Defined in: triggers.ts:182
effects_changed
effects_changed:
EffectsChangedEvent
Defined in: triggers.ts:168
enchanted_item
enchanted_item:
EnchantedItemEvent
Defined in: triggers.ts:150
enter_block
enter_block:
BlockEvent
Defined in: triggers.ts:145
entity_hurt_player
entity_hurt_player:
DamageEvent
Defined in: triggers.ts:149
entity_killed_player
entity_killed_player:
KillEvent
Defined in: triggers.ts:144
fall_after_explosion
fall_after_explosion:
FallAfterExplosionEvent
Defined in: triggers.ts:199
fall_from_height
fall_from_height:
TravelEvent
Defined in: triggers.ts:192
filled_bucket
filled_bucket:
ItemEvent
Defined in: triggers.ts:151
fishing_rod_hooked
fishing_rod_hooked:
FishingRodHookedEvent
Defined in: triggers.ts:171
hero_of_the_village
hero_of_the_village:
PlayerEvent
Defined in: triggers.ts:176
impossible
impossible:
PlayerEvent
Defined in: triggers.ts:142
inventory_changed
inventory_changed:
InventoryEvent
Defined in: triggers.ts:146
item_durability_changed
item_durability_changed:
ItemDurabilityEvent
Defined in: triggers.ts:161
item_used_on_block
item_used_on_block:
ItemUsedOnBlockEvent
Defined in: triggers.ts:181
kill_mob_near_sculk_catalyst
kill_mob_near_sculk_catalyst:
KillEvent
Defined in: triggers.ts:194
killed_by_arrow
killed_by_arrow:
KilledByArrowEvent
Defined in: triggers.ts:175
levitation
levitation:
LevitationEvent
Defined in: triggers.ts:162
lightning_strike
lightning_strike:
LightningStrikeEvent
Defined in: triggers.ts:190
location
location:
PlayerEvent
Defined in: triggers.ts:157
nether_travel
nether_travel:
TravelEvent
Defined in: triggers.ts:170
placed_block
placed_block:
ItemUsedOnBlockEvent
Defined in: triggers.ts:166
player_generates_container_loot
player_generates_container_loot:
ContainerLootEvent
Defined in: triggers.ts:184
player_hurt_entity
player_hurt_entity:
PlayerHurtEntityEvent
Defined in: triggers.ts:148
player_interacted_with_entity
player_interacted_with_entity:
PlayerInteractEvent
Defined in: triggers.ts:187
player_killed_entity
player_killed_entity:
KillEvent
Defined in: triggers.ts:143
player_sheared_equipment
player_sheared_equipment:
PlayerInteractEvent
Defined in: triggers.ts:188
recipe_crafted
recipe_crafted:
RecipeCraftedEvent
Defined in: triggers.ts:197
recipe_unlocked
recipe_unlocked:
RecipeEvent
Defined in: triggers.ts:147
ride_entity_in_lava
ride_entity_in_lava:
TravelEvent
Defined in: triggers.ts:193
shot_crossbow
shot_crossbow:
ItemEvent
Defined in: triggers.ts:173
slept_in_bed
slept_in_bed:
PlayerEvent
Defined in: triggers.ts:158
slide_down_block
slide_down_block:
BlockEvent
Defined in: triggers.ts:178
spear_mobs
spear_mobs:
SpearMobsEvent
Defined in: triggers.ts:174
started_riding
started_riding:
PlayerEvent
Defined in: triggers.ts:189
summoned_entity
summoned_entity:
EntityEvent
Defined in: triggers.ts:155
tame_animal
tame_animal:
EntityEvent
Defined in: triggers.ts:165
target_hit
target_hit:
TargetHitEvent
Defined in: triggers.ts:180
thrown_item_picked_up_by_entity
thrown_item_picked_up_by_entity:
PickedUpItemEvent
Defined in: triggers.ts:185
thrown_item_picked_up_by_player
thrown_item_picked_up_by_player:
PickedUpItemEvent
Defined in: triggers.ts:186
tick
tick:
PlayerEvent
Defined in: triggers.ts:164
used_ender_eye
used_ender_eye:
EnderEyeEvent
Defined in: triggers.ts:154
used_totem
used_totem:
ItemEvent
Defined in: triggers.ts:169
using_item
using_item:
ItemEvent
Defined in: triggers.ts:191
villager_trade
villager_trade:
VillagerTradeEvent
Defined in: triggers.ts:160
voluntary_exile
voluntary_exile:
PlayerEvent
Defined in: triggers.ts:177
VictimsEvent
Defined in: events.ts:193
Several entities hit at once, by a channeled lightning bolt or one arrow.
Extends
Extended by
Properties
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
victims
readonlyvictims: readonlyEntityView[]
Defined in: events.ts:194
VillagerTradeEvent
Defined in: events.ts:122
A villager trade the player completed.
Extends
Properties
item
readonlyitem:ItemStack
Defined in: events.ts:125
The stack the player received.
player
readonlyplayer:EntityView
Defined in: events.ts:22
Inherited from
villager
readonlyvillager:EntityView
Defined in: events.ts:123
Type Aliases
AdvancementFrame
AdvancementFrame = typeof
ADVANCEMENT_FRAMES[number]
Defined in: model.ts:22
One of ADVANCEMENT_FRAMES.
AnyTriggerEvent
AnyTriggerEvent =
TriggerEvents[TriggerName]
Defined in: triggers.ts:203
The union of every event shape, which is what the dispatch index erases to.
CriterionTest
CriterionTest<
K> =EventTest<TriggerEvents[K]>
Defined in: triggers.ts:212
A compiled criterion test for one trigger.
Type Parameters
K
K extends TriggerName
EventParser
EventParser<
E> = (conditions,context) =>EventTest<E>
Defined in: triggers.ts:209
Compiles a conditions object into a test over one event shape.
Type Parameters
E
E
Parameters
conditions
unknown
context
Returns
EventTest<E>
EventTest
EventTest<
E> = (event,services) =>boolean
Defined in: triggers.ts:206
Answers whether one event satisfies a criterion.
Type Parameters
E
E
Parameters
event
E
services
Returns
boolean
KeyedTrigger
KeyedTrigger = keyof typeof
KEYED_TRIGGERS
Defined in: triggers.ts:835
One of the keys of KEYED_TRIGGERS.
PlayerProgressJson
PlayerProgressJson =
Readonly<Record<string,AdvancementProgressJson>>
Defined in: progress.ts:29
Every advancement a player has touched, keyed by namespaced advancement id.
TriggerName
TriggerName = typeof
TRIGGER_TYPES[number]
Defined in: triggers.ts:135
One of TRIGGER_TYPES, without the minecraft: namespace.
TriggerParser
TriggerParser<
K> =EventParser<TriggerEvents[K]>
Defined in: triggers.ts:215
Compiles one trigger's conditions object into a test over its event.
Type Parameters
K
K extends TriggerName
Variables
ADVANCEMENT_FRAMES
constADVANCEMENT_FRAMES: readonly ["task","challenge","goal"]
Defined in: model.ts:19
The three icon frames AdvancementType registers, which decide the toast wording and title color.
KEYED_TRIGGERS
constKEYED_TRIGGERS:object
Defined in: triggers.ts:827
The triggers whose event names one registry element, and the conditions field that holds the ids it must be one of. The dispatch index keys criteria of these triggers by those ids, which is what keeps the recipe-unlock path off a scan through the 1739 vanilla criteria that use it.
Type Declaration
crafter_recipe_crafted
readonlycrafter_recipe_crafted:object
crafter_recipe_crafted.field
readonlyfield:"recipes"='recipes'
crafter_recipe_crafted.registry
readonlyregistry:"recipe"='recipe'
player_generates_container_loot
readonlyplayer_generates_container_loot:object
player_generates_container_loot.field
readonlyfield:"loot_tables"='loot_tables'
player_generates_container_loot.registry
readonlyregistry:"loot_table"='loot_table'
recipe_crafted
readonlyrecipe_crafted:object
recipe_crafted.field
readonlyfield:"recipes"='recipes'
recipe_crafted.registry
readonlyregistry:"recipe"='recipe'
recipe_unlocked
readonlyrecipe_unlocked:object
recipe_unlocked.field
readonlyfield:"recipes"='recipes'
recipe_unlocked.registry
readonlyregistry:"recipe"='recipe'
TRIGGER_TYPES
constTRIGGER_TYPES: readonly ["impossible","player_killed_entity","entity_killed_player","enter_block","inventory_changed","recipe_unlocked","player_hurt_entity","entity_hurt_player","enchanted_item","filled_bucket","brewed_potion","construct_beacon","used_ender_eye","summoned_entity","bred_animals","location","slept_in_bed","cured_zombie_villager","villager_trade","item_durability_changed","levitation","changed_dimension","tick","tame_animal","placed_block","consume_item","effects_changed","used_totem","nether_travel","fishing_rod_hooked","channeled_lightning","shot_crossbow","spear_mobs","killed_by_arrow","hero_of_the_village","voluntary_exile","slide_down_block","bee_nest_destroyed","target_hit","item_used_on_block","default_block_use","any_block_use","player_generates_container_loot","thrown_item_picked_up_by_entity","thrown_item_picked_up_by_player","player_interacted_with_entity","player_sheared_equipment","started_riding","lightning_strike","using_item","fall_from_height","ride_entity_in_lava","kill_mob_near_sculk_catalyst","allay_drop_item_on_block","avoid_vibration","recipe_crafted","crafter_recipe_crafted","fall_after_explosion"]
Defined in: triggers.ts:73
The 58 members of the minecraft:trigger_type registry in Java 26.3, read out of reports/registries.json in protocol id order. Vanilla's own 1866 advancement files use 54 of them; used_ender_eye, voluntary_exile, default_block_use and any_block_use have no vanilla criterion.
Functions
blockUseContext()
blockUseContext(
event,services):PredicateContext
Defined in: events.ts:314
Builds the block_use context default_block_use and any_block_use evaluate their location field in.
Parameters
event
services
Returns
buildAdvancementTree()
buildAdvancementTree(
advancements,collector?):object
Defined in: tree.ts:56
Links parsed advancements into the tree the client draws as tabs.
A parent that names nothing in the set reports and leaves the node a root, so an incomplete datapack still produces a usable tree. A parent chain that closes on itself reports at the first node whose walk revisits an identifier and detaches that node, which breaks the cycle, keeps the rest of the chain linked, and stops any later walk from looping.
Parameters
advancements
Iterable<ParsedAdvancement>
The parsed files, which decide root ordering.
collector?
DiagnosticCollector = ...
Returns
object
The tree together with every fault found while linking it.
diagnostics
readonlydiagnostics: readonlyDiagnostic[]
tree
readonlytree:AdvancementTree
criterionKeys()
criterionKeys(
trigger,conditions,context): readonlystring[] |undefined
Defined in: triggers.ts:845
The registry ids a criterion can match, for a trigger KEYED_TRIGGERS covers. Undefined means the criterion belongs in its trigger's linear bucket, either because the trigger is not keyed or because the field is absent.
Parameters
trigger
"villager_trade" | "enchanted_item" | "impossible" | "player_killed_entity" | "entity_killed_player" | "enter_block" | "inventory_changed" | "recipe_unlocked" | "player_hurt_entity" | "entity_hurt_player" | "filled_bucket" | "brewed_potion" | "construct_beacon" | "used_ender_eye" | "summoned_entity" | "bred_animals" | "location" | "slept_in_bed" | "cured_zombie_villager" | "item_durability_changed" | "levitation" | "changed_dimension" | "tick" | "tame_animal" | "placed_block" | "consume_item" | "effects_changed" | "used_totem" | "nether_travel" | "fishing_rod_hooked" | "channeled_lightning" | "shot_crossbow" | "spear_mobs" | "killed_by_arrow" | "hero_of_the_village" | "voluntary_exile" | "slide_down_block" | "bee_nest_destroyed" | "target_hit" | "item_used_on_block" | "default_block_use" | "any_block_use" | "player_generates_container_loot" | "thrown_item_picked_up_by_entity" | "thrown_item_picked_up_by_player" | "player_interacted_with_entity" | "player_sheared_equipment" | "started_riding" | "lightning_strike" | "using_item" | "fall_from_height" | "ride_entity_in_lava" | "kill_mob_near_sculk_catalyst" | "allay_drop_item_on_block" | "avoid_vibration" | "recipe_crafted" | "crafter_recipe_crafted" | "fall_after_explosion"
conditions
unknown
context
Returns
readonly string[] | undefined
entityContext()
entityContext(
entity,services):PredicateContext
Defined in: events.ts:276
Builds the advancement_entity context Java's EntityPredicate.wrap uses for the player field and every other entity field on a trigger.
Parameters
entity
EntityView | undefined
services
Returns
eventKey()
eventKey(
trigger,event):string|undefined
Defined in: triggers.ts:857
The registry id one event names, for a trigger KEYED_TRIGGERS covers.
Parameters
trigger
"villager_trade" | "enchanted_item" | "impossible" | "player_killed_entity" | "entity_killed_player" | "enter_block" | "inventory_changed" | "recipe_unlocked" | "player_hurt_entity" | "entity_hurt_player" | "filled_bucket" | "brewed_potion" | "construct_beacon" | "used_ender_eye" | "summoned_entity" | "bred_animals" | "location" | "slept_in_bed" | "cured_zombie_villager" | "item_durability_changed" | "levitation" | "changed_dimension" | "tick" | "tame_animal" | "placed_block" | "consume_item" | "effects_changed" | "used_totem" | "nether_travel" | "fishing_rod_hooked" | "channeled_lightning" | "shot_crossbow" | "spear_mobs" | "killed_by_arrow" | "hero_of_the_village" | "voluntary_exile" | "slide_down_block" | "bee_nest_destroyed" | "target_hit" | "item_used_on_block" | "default_block_use" | "any_block_use" | "player_generates_container_loot" | "thrown_item_picked_up_by_entity" | "thrown_item_picked_up_by_player" | "player_interacted_with_entity" | "player_sheared_equipment" | "started_riding" | "lightning_strike" | "using_item" | "fall_from_height" | "ride_entity_in_lava" | "kill_mob_near_sculk_catalyst" | "allay_drop_item_on_block" | "avoid_vibration" | "recipe_crafted" | "crafter_recipe_crafted" | "fall_after_explosion"
event
Returns
string | undefined
isTriggerName()
isTriggerName(
value): value is "villager_trade" | "enchanted_item" | "impossible" | "player_killed_entity" | "entity_killed_player" | "enter_block" | "inventory_changed" | "recipe_unlocked" | "player_hurt_entity" | "entity_hurt_player" | "filled_bucket" | "brewed_potion" | "construct_beacon" | "used_ender_eye" | "summoned_entity" | "bred_animals" | "location" | "slept_in_bed" | "cured_zombie_villager" | "item_durability_changed" | "levitation" | "changed_dimension" | "tick" | "tame_animal" | "placed_block" | "consume_item" | "effects_changed" | "used_totem" | "nether_travel" | "fishing_rod_hooked" | "channeled_lightning" | "shot_crossbow" | "spear_mobs" | "killed_by_arrow" | "hero_of_the_village" | "voluntary_exile" | "slide_down_block" | "bee_nest_destroyed" | "target_hit" | "item_used_on_block" | "default_block_use" | "any_block_use" | "player_generates_container_loot" | "thrown_item_picked_up_by_entity" | "thrown_item_picked_up_by_player" | "player_interacted_with_entity" | "player_sheared_equipment" | "started_riding" | "lightning_strike" | "using_item" | "fall_from_height" | "ride_entity_in_lava" | "kill_mob_near_sculk_catalyst" | "allay_drop_item_on_block" | "avoid_vibration" | "recipe_crafted" | "crafter_recipe_crafted" | "fall_after_explosion"
Defined in: triggers.ts:869
Whether a string names one of TRIGGER_TYPES, with or without the minecraft: namespace.
Parameters
value
string
Returns
value is "villager_trade" | "enchanted_item" | "impossible" | "player_killed_entity" | "entity_killed_player" | "enter_block" | "inventory_changed" | "recipe_unlocked" | "player_hurt_entity" | "entity_hurt_player" | "filled_bucket" | "brewed_potion" | "construct_beacon" | "used_ender_eye" | "summoned_entity" | "bred_animals" | "location" | "slept_in_bed" | "cured_zombie_villager" | "item_durability_changed" | "levitation" | "changed_dimension" | "tick" | "tame_animal" | "placed_block" | "consume_item" | "effects_changed" | "used_totem" | "nether_travel" | "fishing_rod_hooked" | "channeled_lightning" | "shot_crossbow" | "spear_mobs" | "killed_by_arrow" | "hero_of_the_village" | "voluntary_exile" | "slide_down_block" | "bee_nest_destroyed" | "target_hit" | "item_used_on_block" | "default_block_use" | "any_block_use" | "player_generates_container_loot" | "thrown_item_picked_up_by_entity" | "thrown_item_picked_up_by_player" | "player_interacted_with_entity" | "player_sheared_equipment" | "started_riding" | "lightning_strike" | "using_item" | "fall_from_height" | "ride_entity_in_lava" | "kill_mob_near_sculk_catalyst" | "allay_drop_item_on_block" | "avoid_vibration" | "recipe_crafted" | "crafter_recipe_crafted" | "fall_after_explosion"
locationContext()
locationContext(
event,services):PredicateContext
Defined in: events.ts:295
Builds the advancement_location context the placed_block family evaluates its location field in.
Parameters
event
services
Returns
parseAdvancement()
parseAdvancement(
id,json,options?):ParseResult<ParsedAdvancement|undefined>
Defined in: model.ts:252
Parses one advancement file. Nothing throws: a fault lands in the diagnostics and the value is undefined only when the file has no usable criterion at all.
Parameters
id
string
Namespaced identifier the file is registered under.
json
unknown
options?
Pass resolver so #tag references in rewards.loot, recipes fields and nested loot conditions resolve, and diagnostics to gather a whole datapack into one report.
Returns
ParseResult<ParsedAdvancement | undefined>
parseTrigger()
parseTrigger<
K>(trigger,conditions,context):CriterionTest<K>
Defined in: triggers.ts:877
Compiles one criterion's conditions into a test over the event its trigger declares.
Type Parameters
K
K extends "villager_trade" | "enchanted_item" | "impossible" | "player_killed_entity" | "entity_killed_player" | "enter_block" | "inventory_changed" | "recipe_unlocked" | "player_hurt_entity" | "entity_hurt_player" | "filled_bucket" | "brewed_potion" | "construct_beacon" | "used_ender_eye" | "summoned_entity" | "bred_animals" | "location" | "slept_in_bed" | "cured_zombie_villager" | "item_durability_changed" | "levitation" | "changed_dimension" | "tick" | "tame_animal" | "placed_block" | "consume_item" | "effects_changed" | "used_totem" | "nether_travel" | "fishing_rod_hooked" | "channeled_lightning" | "shot_crossbow" | "spear_mobs" | "killed_by_arrow" | "hero_of_the_village" | "voluntary_exile" | "slide_down_block" | "bee_nest_destroyed" | "target_hit" | "item_used_on_block" | "default_block_use" | "any_block_use" | "player_generates_container_loot" | "thrown_item_picked_up_by_entity" | "thrown_item_picked_up_by_player" | "player_interacted_with_entity" | "player_sheared_equipment" | "started_riding" | "lightning_strike" | "using_item" | "fall_from_height" | "ride_entity_in_lava" | "kill_mob_near_sculk_catalyst" | "allay_drop_item_on_block" | "avoid_vibration" | "recipe_crafted" | "crafter_recipe_crafted" | "fall_after_explosion"
Parameters
trigger
K
A registered trigger name without its namespace.
conditions
unknown
context
Returns
requirementsCount()
requirementsCount(
requirements,isDone):number
Defined in: progress.ts:16
How many of the requirements groups are satisfied, which is what a progress bar shows.
Parameters
requirements
readonly (readonly string[])[]
isDone
(criterion) => boolean
Returns
number
requirementsMet()
requirementsMet(
requirements,isDone):boolean
Defined in: progress.ts:10
Whether the conjunctive normal form in requirements is satisfied: every group needs at least one completed criterion. The single-criterion default is one group of one name, so it completes with that criterion.
Parameters
requirements
readonly (readonly string[])[]
isDone
(criterion) => boolean
Answers whether one criterion name has been completed.
Returns
boolean