Alpha: this compiler is under active development and updates will break your projects. Not recommended for real use yet.
Skip to content

helix / ExecuteBuilder

Interface: ExecuteBuilder โ€‹

Defined in: core/commands/execute/builder.ts:33

An execute chain from ctx.execute(): each method adds a clause, and run ends it, e.g. ctx.execute().as(sel).at(Selector.self()).run((c) => ...).

Extends โ€‹

  • ExecuteShifts

Properties โ€‹

ctx โ€‹

protected readonly ctx: FunctionContext

Defined in: core/commands/execute/shifts.ts:11

Inherited from โ€‹

ExecuteShifts.ctx


node โ€‹

protected readonly node: ExecuteNode

Defined in: core/commands/execute/shifts.ts:12

Inherited from โ€‹

ExecuteShifts.node

Methods โ€‹

align() โ€‹

align(axes): this

Defined in: core/commands/execute/shifts.ts:84

align <axes> - snap the position to the block grid on those axes (e.g. "xyz").

Parameters โ€‹

axes โ€‹

Swizzle

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.align


anchored() โ€‹

anchored(anchor): this

Defined in: core/commands/execute/shifts.ts:70

anchored eyes|feet - which point on the executor ^-local coords pivot on.

Parameters โ€‹

anchor โ€‹

EntityAnchor

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.anchored


as() โ€‹

as(sel): this

Defined in: core/commands/execute/shifts.ts:30

Runs as each entity sel matches (as), without moving.

Parameters โ€‹

sel โ€‹

Selector

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.as


at() โ€‹

at(sel): this

Defined in: core/commands/execute/shifts.ts:34

Moves to each entity sel matches (at): position, rotation and dimension.

Parameters โ€‹

sel โ€‹

Selector

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.at


done() โ€‹

done(): void

Defined in: core/commands/execute/builder.ts:251

Ends the chain with no run; the conditions are the command.

E.g. execute store result score <s> if entity <sel> counts matches; a run would change the count.

Returns โ€‹

void


facing() โ€‹

facing(pos): this

Defined in: core/commands/execute/shifts.ts:62

facing <pos> - rotate so ^-local coords aim at pos.

Parameters โ€‹

pos โ€‹

PosValue

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.facing


facingEntity() โ€‹

facingEntity(sel, anchor?): this

Defined in: core/commands/execute/shifts.ts:66

facing entity <sel> eyes|feet - rotate so ^-local coords aim at the entity.

Parameters โ€‹

sel โ€‹

Selector

anchor? โ€‹

EntityAnchor = EntityAnchor.FEET

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.facingEntity


ifBlock() โ€‹

ifBlock(pos, block): this

Defined in: core/commands/execute/builder.ts:89

if block <pos> <block> - true when the block at pos matches (id, state, or #tag).

Parameters โ€‹

pos โ€‹

PosValue

block โ€‹

Block

Returns โ€‹

this


ifBlockData() โ€‹

ifBlockData(pos, path): this

Defined in: core/commands/execute/builder.ts:126

if data block <pos> <path>: passes when path matches anything in the block entity.

Parameters โ€‹

pos โ€‹

PosValue

path โ€‹

NbtPathValue

Returns โ€‹

this


ifDimension() โ€‹

ifDimension(dim): this

Defined in: core/commands/execute/builder.ts:134

if dimension <dim> - the execution position is in dim.

Parameters โ€‹

dim โ€‹

IdValue

Returns โ€‹

this


ifEntity() โ€‹

ifEntity(sel): this

Defined in: core/commands/execute/builder.ts:51

Passes when sel matches at least one entity.

Parameters โ€‹

sel โ€‹

Selector

Returns โ€‹

this


ifEntityData() โ€‹

ifEntityData(sel, path): this

Defined in: core/commands/execute/builder.ts:110

if data entity <sel> <path>: passes when path matches anything on the entity. Unlike data get, it passes when the path matches several elements.

Parameters โ€‹

sel โ€‹

Selector

path โ€‹

NbtPathValue

Returns โ€‹

this


ifFunction() โ€‹

ifFunction(fn): this

Defined in: core/commands/execute/builder.ts:62

if function <fn>: runs fn and passes if it returns non-zero. Note this calls the function.

Parameters โ€‹

fn โ€‹

FunctionRef

Returns โ€‹

this


ifItems() โ€‹

ifItems(sel, slot, item): this

Defined in: core/commands/execute/builder.ts:79

if items entity <sel> <slot> <item>: tests one specific inventory slot. The item predicate is built from the same ItemValue you give, so components match exactly.

Parameters โ€‹

sel โ€‹

Selector

slot โ€‹

SlotRange

item โ€‹

ItemLike

Returns โ€‹

this


ifItemsBlock() โ€‹

ifItemsBlock(pos, slot, item): this

Defined in: core/commands/execute/builder.ts:97

if items block <pos> <slot> <item>: tests a container's slots.

Parameters โ€‹

pos โ€‹

PosValue

slot โ€‹

SlotRange

item โ€‹

ItemLike

Returns โ€‹

this


ifPredicate() โ€‹

ifPredicate(ref): this

Defined in: core/commands/execute/builder.ts:142

Passes when the predicate holds.

Parameters โ€‹

ref โ€‹

PredicateLike

Returns โ€‹

this


ifScore() โ€‹

ifScore(a, op, b): this

Defined in: core/commands/execute/builder.ts:43

Passes when a op b holds between two scores.

Parameters โ€‹

a โ€‹

Score

op โ€‹

"=" | "<" | ">" | "<=" | ">="

b โ€‹

Score

Returns โ€‹

this


ifScoreMatches() โ€‹

ifScoreMatches(score, range): this

Defined in: core/commands/execute/builder.ts:35

Passes when score is in range (if score ... matches).

Parameters โ€‹

score โ€‹

Score

range โ€‹

Range

Returns โ€‹

this


ifStorageData() โ€‹

ifStorageData(id, path): this

Defined in: core/commands/execute/builder.ts:118

if data storage <id> <path>: passes when path matches anything in the storage.

Parameters โ€‹

id โ€‹

Storage

path โ€‹

NbtPathValue

Returns โ€‹

this


in() โ€‹

in(dim): this

Defined in: core/commands/execute/shifts.ts:38

Moves to the same coordinates in dimension dim.

Parameters โ€‹

dim โ€‹

IdValue

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.in


on() โ€‹

on(relation): this

Defined in: core/commands/execute/shifts.ts:80

on <relation>: switch the executor to a related entity (target, vehicle, owner...) without moving.

If there's no such entity the chain does nothing, so on target also tests "is it fighting?".

Parameters โ€‹

relation โ€‹

Relation

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.on


positioned() โ€‹

positioned(pos): this

Defined in: core/commands/execute/shifts.ts:42

Moves the execution position to pos.

Parameters โ€‹

pos โ€‹

PosValue

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.positioned


positionedAs() โ€‹

positionedAs(sel): this

Defined in: core/commands/execute/shifts.ts:46

Moves to the entity's position, keeping rotation.

Parameters โ€‹

sel โ€‹

Selector

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.positionedAs


positionedOver() โ€‹

positionedOver(heightmap): this

Defined in: core/commands/execute/shifts.ts:50

positioned over <heightmap> - keep x/z, move y to the top of that heightmap.

Parameters โ€‹

heightmap โ€‹

Heightmap

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.positionedOver


push() โ€‹

protected push(clause): this

Defined in: core/commands/execute/shifts.ts:24

Parameters โ€‹

clause โ€‹

Clause

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.push


returnRun() โ€‹

returnRun(build): void

Defined in: core/commands/execute/builder.ts:261

Ends the chain with run return run <body>: when the conditions hold, the function ends here.

Parameters โ€‹

build โ€‹

(ctx) => void

Returns โ€‹

void


rotated() โ€‹

rotated(rot): this

Defined in: core/commands/execute/shifts.ts:54

rotated <yaw> <pitch> - e.g. Pos.rel(0, Pos.abs(0)) keeps yaw, levels pitch.

Parameters โ€‹

rot โ€‹

PosValue

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.rotated


rotatedAs() โ€‹

rotatedAs(sel): this

Defined in: core/commands/execute/shifts.ts:58

Takes the entity's rotation, keeping position.

Parameters โ€‹

sel โ€‹

Selector

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.rotatedAs


run() โ€‹

run(build): void

Defined in: core/commands/execute/builder.ts:254

Ends the chain with run <body>. One command inlines; more go in a child function.

Parameters โ€‹

build โ€‹

(ctx) => void

Returns โ€‹

void


runOrInline() โ€‹

runOrInline(build): void

Defined in: core/commands/execute/builder.ts:270

run, or if no clauses were added, emits build directly instead of execute run ....

Parameters โ€‹

build โ€‹

(ctx) => void

Returns โ€‹

void


storeResultBlock() โ€‹

storeResultBlock(pos, path, type, scale): this

Defined in: core/commands/execute/builder.ts:210

store result block <pos> <path> <type> <scale>: writes into a block entity's NBT.

Parameters โ€‹

pos โ€‹

PosValue

path โ€‹

NbtPathValue

type โ€‹

StoreNumType

scale โ€‹

number

Returns โ€‹

this


storeResultBossbar() โ€‹

storeResultBossbar(id, field): this

Defined in: core/commands/execute/builder.ts:237

store <result|success> bossbar <id> <value|max>. The only way to drive a bar from a runtime value.

Parameters โ€‹

id โ€‹

IdValue

field โ€‹

BossbarField

Returns โ€‹

this


storeResultEntity() โ€‹

storeResultEntity(sel, path, type, scale): this

Defined in: core/commands/execute/builder.ts:162

store <result|success> entity <sel> <path> <type> <scale>: writes straight into entity NBT. scale turns an integer score into the fractional value the field needs.

Parameters โ€‹

sel โ€‹

Selector

path โ€‹

NbtPathValue

type โ€‹

StoreNumType

scale โ€‹

number

Returns โ€‹

this


storeResultScore() โ€‹

storeResultScore(score): this

Defined in: core/commands/execute/builder.ts:150

Stores the command's result in score, as a raw integer; a scaled score is not rescaled.

Parameters โ€‹

score โ€‹

Score

Returns โ€‹

this


storeResultStorage() โ€‹

storeResultStorage(id, path, type, scale): this

Defined in: core/commands/execute/builder.ts:194

Stores the result in storage id at path, as type times scale.

Parameters โ€‹

id โ€‹

Storage

path โ€‹

NbtPathValue

type โ€‹

StoreNumType

scale โ€‹

number

Returns โ€‹

this


storeSuccessBlock() โ€‹

storeSuccessBlock(pos, path, type, scale): this

Defined in: core/commands/execute/builder.ts:214

Like storeResultBlock, but stores 1 or 0 for success.

Parameters โ€‹

pos โ€‹

PosValue

path โ€‹

NbtPathValue

type โ€‹

StoreNumType

scale โ€‹

number

Returns โ€‹

this


storeSuccessBossbar() โ€‹

storeSuccessBossbar(id, field): this

Defined in: core/commands/execute/builder.ts:241

Stores 1 or 0 for success in bossbar id's value or max.

Parameters โ€‹

id โ€‹

IdValue

field โ€‹

BossbarField

Returns โ€‹

this


storeSuccessEntity() โ€‹

storeSuccessEntity(sel, path, type, scale): this

Defined in: core/commands/execute/builder.ts:178

Like storeResultEntity, but stores 1 or 0 for success.

Parameters โ€‹

sel โ€‹

Selector

path โ€‹

NbtPathValue

type โ€‹

StoreNumType

scale โ€‹

number

Returns โ€‹

this


storeSuccessScore() โ€‹

storeSuccessScore(score): this

Defined in: core/commands/execute/builder.ts:154

Stores 1 in score if the command succeeded, else 0.

Parameters โ€‹

score โ€‹

Score

Returns โ€‹

this


storeSuccessStorage() โ€‹

storeSuccessStorage(id, path, type, scale): this

Defined in: core/commands/execute/builder.ts:218

Stores 1 or 0 for success in storage id at path.

Parameters โ€‹

id โ€‹

Storage

path โ€‹

NbtPathValue

type โ€‹

StoreNumType

scale โ€‹

number

Returns โ€‹

this


summon() โ€‹

summon(entity): this

Defined in: core/commands/execute/shifts.ts:88

summon <entity>: summons one entity here and runs the rest of the chain as it.

Parameters โ€‹

entity โ€‹

EntityType

Returns โ€‹

this

Inherited from โ€‹

ExecuteShifts.summon


unlessBlock() โ€‹

unlessBlock(pos, block): this

Defined in: core/commands/execute/builder.ts:93

Passes when the block at pos does not match.

Parameters โ€‹

pos โ€‹

PosValue

block โ€‹

Block

Returns โ€‹

this


unlessBlockData() โ€‹

unlessBlockData(pos, path): this

Defined in: core/commands/execute/builder.ts:130

Passes when path matches nothing in the block entity.

Parameters โ€‹

pos โ€‹

PosValue

path โ€‹

NbtPathValue

Returns โ€‹

this


unlessDimension() โ€‹

unlessDimension(dim): this

Defined in: core/commands/execute/builder.ts:138

Passes when the execution position is not in dim.

Parameters โ€‹

dim โ€‹

IdValue

Returns โ€‹

this


unlessEntity() โ€‹

unlessEntity(sel): this

Defined in: core/commands/execute/builder.ts:55

Passes when sel matches no entity.

Parameters โ€‹

sel โ€‹

Selector

Returns โ€‹

this


unlessEntityData() โ€‹

unlessEntityData(sel, path): this

Defined in: core/commands/execute/builder.ts:114

Passes when path matches nothing on the entity.

Parameters โ€‹

sel โ€‹

Selector

path โ€‹

NbtPathValue

Returns โ€‹

this


unlessFunction() โ€‹

unlessFunction(fn): this

Defined in: core/commands/execute/builder.ts:66

unless function <fn>: runs fn and passes if it returns zero or fails.

Parameters โ€‹

fn โ€‹

FunctionRef

Returns โ€‹

this


unlessItems() โ€‹

unlessItems(sel, slot, item): this

Defined in: core/commands/execute/builder.ts:84

Passes when that slot does not hold item.

Parameters โ€‹

sel โ€‹

Selector

slot โ€‹

SlotRange

item โ€‹

ItemLike

Returns โ€‹

this


unlessItemsBlock() โ€‹

unlessItemsBlock(pos, slot, item): this

Defined in: core/commands/execute/builder.ts:102

Passes when no container slot matching slot holds item.

Parameters โ€‹

pos โ€‹

PosValue

slot โ€‹

SlotRange

item โ€‹

ItemLike

Returns โ€‹

this


unlessPredicate() โ€‹

unlessPredicate(ref): this

Defined in: core/commands/execute/builder.ts:146

Passes when the predicate fails.

Parameters โ€‹

ref โ€‹

PredicateLike

Returns โ€‹

this


unlessScore() โ€‹

unlessScore(a, op, b): this

Defined in: core/commands/execute/builder.ts:47

Passes when a op b does not hold.

Parameters โ€‹

a โ€‹

Score

op โ€‹

"=" | "<" | ">" | "<=" | ">="

b โ€‹

Score

Returns โ€‹

this


unlessScoreMatches() โ€‹

unlessScoreMatches(score, range): this

Defined in: core/commands/execute/builder.ts:39

Passes when score is outside range.

Parameters โ€‹

score โ€‹

Score

range โ€‹

Range

Returns โ€‹

this


unlessStorageData() โ€‹

unlessStorageData(id, path): this

Defined in: core/commands/execute/builder.ts:122

Passes when path matches nothing in the storage.

Parameters โ€‹

id โ€‹

Storage

path โ€‹

NbtPathValue

Returns โ€‹

this


when() โ€‹

when(detector): this

Defined in: core/commands/execute/builder.ts:70

Adds detector's clauses, so a condition can sit in a store chain.

Parameters โ€‹

detector โ€‹

Detector

Returns โ€‹

this

Released under the MIT License ยท Credits
These docs were written with AI; the layout and every page have been reviewed by a human.