Command IR Instruction Reference - simon816/Command-Block-Assembly GitHub Wiki

Summary

Instructions

Basic Commands and Instructions

as_single_cmd

<ret> = as_single_cmd <block>

Forces a basic block to become a single command, the command is returned as a command variable. An error is raised if the block cannot be a single command.

block: BasicBlock The basic block

ret: CmdFunction

Allowed locations: preamble


bar_set_max

bar_set_max <bar>, <max>

Sets the maximum value for a bossbar.

bar: BossbarRef Bar to modify

max: int Max value

Allowed locations: runtime code


bar_set_players

bar_set_players <bar>, <players>

Set the players who can see the bossbar.

bar: BossbarRef Bossbar

players: Opt(EntitySelection) Players. If NULL then no players will be shown the bar

Allowed locations: runtime code


bar_set_value

bar_set_value <bar>, <val>

Sets the current value of the given bossbar.

bar: BossbarRef Bossbar to modify

val: int Bar value

Allowed locations: runtime code


clear

clear <targets>, <item>, <max_count>

Clears items matching the given item type from targetted entities.

targets: EntitySelection Entities to clear the item from

item: ItemType Item to clear

max_count: int Max count of items. -1 to clear all matching items.

Allowed locations: runtime code


clone

clone <src0>, <src1>, <dest>

Clones a region of blocks specified by a lower left and upper right bound to a given destination position.

src0: Position Lower left position

src1: Position Upper right position

dest: Position Destination position

Allowed locations: runtime code


copy

<ret> = copy <any>

Creates a deep copy of an object. Only certain object types can be copied.

any: NativeType Any object that supports copying

ret: NativeType

Allowed locations: preamble


getter

<ret> = getter <var>

Returns a command variable that when run, gives the variable's value in the 'result' of the command's execution.

var: Variable The variable to create the getter for

ret: CmdFunction

Allowed locations: preamble


give

give <targets>, <item>, <count>

Gives targetted entities an item.

targets: EntitySelection Entities to give the item to

item: ItemType The item to give

count: int Item count

Allowed locations: runtime code


give_effect

give_effect <target>, <effect>, <seconds>, <amp>, <hide_particles>

Gives target entities the specified effect. See /effect for details.

target: EntitySelection Entities to give the effect to

effect: VirtualString The effect name

seconds: Opt(int) Number of seconds the effect will last

amp: Opt(int) Amplifier

hide_particles: Opt(str) Whether to hide particles (true|false)

Allowed locations: runtime code


join_team

join_team <team>, <members>

Adds the specified entities to the given team.

team: TeamRef The team to join

members: Opt(EntitySelection) Members joining the team. If NULL then the current command sender is added.

Allowed locations: runtime code


kill

kill <target>

Despawns the target entities from the world.

target: EntitySelection Entities to despawn

Allowed locations: runtime code


move_to_entity

move_to_entity <sources>, <target>

Moves entities to another target entity.

sources: EntitySelection Entities to move

target: EntitySelection Destination entity

Allowed locations: runtime code


pragma

pragma <key>, <value>

Set a pragma value. Pragmas are implementation defined and generally should not be configured by end users.

key: str Pragma name

value: VirtualString Pragma value

Allowed locations: global preamble


replace_block_item

replace_block_item <pos>, <slot>, <item>, <amount>

Replaces an item in a block's inventory at a specified slot with the given item. See /replaceitem for details.

pos: Position Block position

slot: VirtualString Inventory slot

item: ItemType Replacement item

amount: Opt(int) Replace amount

Allowed locations: runtime code


replace_entity_item

replace_entity_item <target>, <slot>, <item>, <amount>

Replaces an item in an entity's inventory at a specified slot with the given item. See /replaceitem for details.

target: EntitySelection Target entities to replace their items

slot: VirtualString Inventory slot

item: ItemType Replacement item

amount: Opt(int) Replace amount

Allowed locations: runtime code


run_cmd

run_cmd <cmd>

Runs the command given in the command variable.

cmd: CmdFunction The command variable

Allowed locations: runtime code


set_title_times

set_title_times <player>, <fade_in>, <stay>, <fade_out>

Sets the timer parameters for a title being shown to the player.

player: EntitySelection Players to set the times on

fade_in: int Title fade in time

stay: int Title stay time

fade_out: int Title fade out time

Allowed locations: runtime code


setblock

setblock <pos>, <block>

Sets a block in the world at the given position to the given block type.

pos: Position The block position

block: BlockType The block type

Allowed locations: runtime code


spawn_entity

spawn_entity <entity>, <pos>, <data>

Spawns an entity of the given type at a position.

entity: VirtualString Entity type name

pos: Opt(Position) Position. Defaults to the location of the sender

data: Opt(NBTCompound) Optional NBT data for the entity

Allowed locations: runtime code


spawn_particle

spawn_particle <name>, <pos>, <delta>, <speed>, <count>, <mode>, <targets>

Spawn particle effects with the given parameters. See /particle for details.

name: VirtualString Particle name

pos: Position Position to spawn at

delta: Position Volume to spawn in

speed: float Speed of the particle

count: int Number of particles

mode: str Display mode (normal|force)

targets: Opt(EntitySelection) Players to show the particles to

Allowed locations: runtime code


team_collision

team_collision <team>, <behaviour>

Sets the collision behavious for a given team.

team: TeamRef Team to modify

behaviour: str Collision behaviour

Allowed locations: runtime code


team_color

team_color <team>, <color>

Sets the color for a team.

team: TeamRef Team to modify

color: TextColor Color of the team

Allowed locations: runtime code


teleport

teleport <target>, <pos>

Moves target entities to a specified position.

target: EntitySelection Entities to move

pos: Position Position to move to

Allowed locations: runtime code


title

title <player>, <action>, <text>

Show a title text to the specified players.

player: EntitySelection Players to show to

action: str 'clear' or 'reset', otherwise title|subtitle|actionbar

text: Opt(TextObject) Text to show

Allowed locations: runtime code


tp_with_rot

tp_with_rot <target>, <pos>, <yrot>, <xrot>

Moves entities to the given position with a specific rotation.

target: EntitySelection Entities to move

pos: Position Position to move to

yrot: (int|float|RelPosVal|AncPosVal) y rotation

xrot: (int|float|RelPosVal|AncPosVal) x rotation

Allowed locations: runtime code

Control Flow

branch

branch <label>

Unconditionally branch to the given label.

label: BasicBlock Destination to branch to

Allowed locations: compiletime, runtime code


call

call <label>

'calls' a label instead of branching. The label must be tagged with the 'function' modifier. Control will resume to the next instruction after the label has been executed.

label: BasicBlock Label tagged as a function

Allowed locations: compiletime, runtime code


clear_command_block

clear_command_block

Remove any value from the special command block.

Allowed locations: runtime code


clear_zero_tick

clear_zero_tick

Remove any function from the special zero-tick command block and clear the zero-tick flag.

Allowed locations: runtime code


cmpbr

cmpbr <left>, <op>, <right>, <if_true>, <if_false>

Compare two variables and jump depending on the comparison.

left: Variable Left variable

op: str Operator for comparison, one of: lt|le|eq|ge|gt

right: Variable Right variable

if_true: Opt(FunctionLike) Label to branch if true

if_false: Opt(FunctionLike) Label to branch to otherwise

Allowed locations: compiletime, runtime code


deferred_invoke

deferred_invoke <func>, <retblock>, <fnargs>, <retvars>

Invokes an 'open' function. i.e. a function that does not return to the caller immediately. The function must call the callback function once complete, use run_callback_on_exit for this.

func: VisibleFunction Function to invoke

retblock: BasicBlock Block to jump after invoke is finished

fnargs: Opt(tuple) Parameters to pass to the function

retvars: Opt(tuple) Tuple of Variables to place return values into

Allowed locations: runtime code


get_stack_head

get_stack_head <dest>

Copies the head of the global stack into the given variable. Do not use in normal circumstances, instead use paramteter passing.

dest: Variable Variable to copy into

Allowed locations: runtime code


invoke

invoke <func>, <fnargs>, <retvars>

Invokes a function.

func: VisibleFunction Function to invoke

fnargs: Opt(tuple) Parameters to pass to the function

retvars: Opt(tuple) Tuple of Variables to place return values into

Allowed locations: runtime code


pop_stack

pop_stack

Removes the head of the global stack. Do not use in normal circumstances, instead use parameter passing.

Allowed locations: runtime code


push_function

push_function <func>

Push a function pointer to the top of the global stack.

func: FunctionLike Function to push

Allowed locations: runtime code


push_stack_frame

push_stack_frame <framevals>

(Internal) Create a new stackframe.

framevals: tuple Frame content

Allowed locations: runtime code


push_stack_val

push_stack_val <value>

Push a value to the top of the global stack.

value: (Variable|int) Value to push

Allowed locations: runtime code


rangebr

rangebr <var>, <min>, <max>, <if_true>, <if_false>

Branch to a label depending on the value of a variable.

var: Variable Variable to test

min: Opt(int) Minimum value, or NULL for negative infinity

max: Opt(int) Maximum value, or NULL for positive infinity

if_true: Opt(FunctionLike) Label to jump to if min <= var <= max

if_false: Opt(FunctionLike) Label to jump to otherwise

Allowed locations: compiletime, runtime code


ret

ret

Return from a function.

Allowed locations: compiletime, runtime code


run_deferred_callback

run_deferred_callback

(Internal) Copies the callback function from the stackframe into the zero tick block. See deferred_invoke.

Allowed locations: runtime code


set_command_block

set_command_block <func>

Sets the special command block to run the given function on the next tick.

func: FunctionLike Function to run

Allowed locations: runtime code


set_command_block_from_stack

set_command_block_from_stack

Copies the value from the top of the global stack into the special command block.

Allowed locations: runtime code


set_zero_tick

set_zero_tick <ref>

Sets the special zero-tick command block to the given function or function reference. The function will execute in the same tick once control is returned to the command block.

ref: (Variable|FunctionLike) Function reference

Allowed locations: runtime code


set_zero_tick_from_stack

set_zero_tick_from_stack

Sets the special zero-tick command block to execute the function at the top of the global stack. The function will execute in the same tick once control is returned to the command block.

Allowed locations: runtime code

Events

add_event_condition

add_event_condition <event>, <path>, <value>

Add a condition to an event that must be true for the event handler to be invoked.

event: AdvEventRef Event to add the condition to

path: VirtualString JSON path in the advancement

value: VirtualString Value that must match

Allowed locations: preamble


adv_event

<ret> = adv_event <event_name>

Creates an advancement-based event object.

event_name: VirtualString The event name

ret: AdvEventRef

Allowed locations: preamble


event_handler

event_handler <handler>, <event>

Add an event handler to the given event specification.

handler: IRFunction Event handler

event: EventRef Event

Allowed locations: global preamble


fire_event

fire_event <event>

Fires a tag-based event to all listeners.

event: TagEventRef Tag event to fire

Allowed locations: runtime code


revoke_event_adv

revoke_event_adv <func>

(Internal) Revokes an advancement to allow an event to re-fire.

func: IRFunction Handler

Allowed locations: runtime code


setupfn

setupfn <func>

Tags a function as being part of the setup phase. It is called whenever the datapack is reloaded.

func: VisibleFunction The setup function

Allowed locations: global preamble


tag_event

<ret> = tag_event <tag_name>

Creates a tag-based event object.

tag_name: VirtualString The function tag name

ret: TagEventRef

Allowed locations: preamble

Execute Instructions

exec_align

exec_align <chain>, <axes>

Executes the rest of the chain with the position aligned to the given axes. See /execute align for details.

chain: ExecChain Execute chain

axes: str Axes

Allowed locations: compiletime


exec_anchor

exec_anchor <chain>, <anchor>

Execute the rest of the chain with the anchor position (^) fixed to either feet or eyes of the current entity.

chain: ExecChain Execute chain

anchor: str 'feet' or 'eyes'

Allowed locations: compiletime


exec_as

exec_as <chain>, <target>

Executes the rest of the chain for each entity matching the given selection, changing @s to refer to the current matching entity.

chain: ExecChain Execute chain

target: EntitySelection Entities to iterate over

Allowed locations: compiletime


exec_at_entity

exec_at_entity <chain>, <target>

Executes the rest of the chain for each entity matching the given selection, changing the relative position, rotation and dimension to originate from the matching entity.

chain: ExecChain Execute chain

target: EntitySelection Entities to iterate over

Allowed locations: compiletime


exec_at_entity_pos

exec_at_entity_pos <chain>, <target>

Executes the rest of the chain using just the position of each matching entity.

chain: ExecChain Execute chain

target: EntitySelection Entities to iterate over

Allowed locations: compiletime


exec_at_pos

exec_at_pos <chain>, <pos>

Executes the rest of the chain from the given position.

chain: ExecChain Execute chain

pos: Position Position

Allowed locations: compiletime


exec_face_entity

exec_face_entity <chain>, <target>, <feature>

Executes the rest of the chain with a rotation that faces the given target entity's feature.

chain: ExecChain Execute chain

target: EntitySelection Target entity to face

feature: str 'eyes' or 'feet'

Allowed locations: compiletime


exec_face_pos

exec_face_pos <chain>, <pos>

Executes the rest of the chain with a rotation that faces the given position.

chain: ExecChain Execute chain

pos: Position Look position

Allowed locations: compiletime


exec_finish

exec_finish <exec>

Finishes an execute chain without running an action. Used when only interested in whether a conditional matched or not.

exec: ExecChain Execute chain

Allowed locations: runtime code


exec_if_block

exec_if_block <chain>, <pos>, <block>

Only execute the rest of the chain if the given block specification matches.

chain: ExecChain Execute chain

pos: Position Block position

block: BlockType Block type to test for

Allowed locations: compiletime


exec_if_blocks

exec_if_blocks <chain>, <begin>, <end>, <dest>, <type>

See /execute if blocks.

chain: ExecChain Execute chain

begin: Position Begin position

end: Position End position

dest: Position Test position

type: str all or masked

Allowed locations: compiletime


exec_if_cmp

exec_if_cmp <chain>, <left>, <op>, <right>

Executes the rest of the chain if the left variable relates to the right variable using the given operation.

chain: ExecChain Execute chain

left: Variable Left variable

op: str Operator, one of: lt|le|eq|ge|gt

right: Variable Right variable

Allowed locations: compiletime


exec_if_entity

exec_if_entity <chain>, <target>

Execute the rest of the chain if at least one entity is found matching the given selection.

chain: ExecChain Execute chain

target: EntitySelection Entities

Allowed locations: compiletime


exec_if_nbt_var

exec_if_nbt_var <chain>, <var>

Executes the rest of the chain if the NBT path to the given variable exists. Note that the variable must be backed by NBT.

chain: ExecChain Execute chain

var: Variable NBT Variable

Allowed locations: compiletime


exec_if_var

exec_if_var <chain>, <var>, <min>, <max>

Execute the rest of the chain if the given variable is within the given bounds.

chain: ExecChain Execute chain

var: Variable Variable

min: Opt(int) Minimum value, or NULL for negative infinity

max: Opt(int) Maximum value, or NULL for positive infinity

Allowed locations: compiletime


exec_rot_entity

exec_rot_entity <chain>, <target>

Executes the rest of the chain with the rotation equivalent to the rotation of the given entity.

chain: ExecChain Execute chain

target: EntitySelection Entities to execute with the rotation of

Allowed locations: compiletime


exec_rotate

exec_rotate <chain>, <y>, <x>

Executes the rest of the chain with the given rotation.

chain: ExecChain Execute chain

y: (int|float|RelPosVal) Y rotation

x: (int|float|RelPosVal) X rotation

Allowed locations: compiletime


exec_run

exec_run <exec>, <func>

Finishes the execute chain by running either a command variable, a function label, or a function that takes no parameters.

exec: ExecChain Execute chain

func: (CmdFunction|FunctionLike) Function or command to run

Allowed locations: runtime code


exec_store

exec_store <chain>, <storetype>, <spec>

Adds an execute store component to the execute chain.

chain: ExecChain Execute chain

storetype: str Either result or success

spec: ExecStoreSpec Execute store specificaion

Allowed locations: compiletime


exec_store_bar

<ret> = exec_store_bar <bar>, <attr>

Creates an execute store specification that stores into a bossbar.

bar: BossbarRef Bossbar to store into

attr: str Attribute to store into, either 'value' or 'max'

ret: ExecStoreSpec

Allowed locations: preamble


exec_store_entity

<ret> = exec_store_entity <target>, <path>, <nbttype>, <scale>

Create an execute store specification that stores into an entity's NBT.

target: EntitySelection Target entity

path: VirtualString NBT path

nbttype: NBTType NBT type

scale: (int|float) Scale before storing

ret: ExecStoreSpec

Allowed locations: preamble


exec_store_var

<ret> = exec_store_var <var>

Creates an execute store specification that stores into a variable.

var: Variable Variable to store into

ret: ExecStoreSpec

Allowed locations: preamble


exec_unless_block

exec_unless_block <chain>, <pos>, <block>

Only execute the rest of the chain if the given block specification doesn't match.

chain: ExecChain Execute chain

pos: Position Block position

block: BlockType Block type to test for

Allowed locations: compiletime


exec_unless_blocks

exec_unless_blocks <chain>, <begin>, <end>, <dest>, <type>

See /execute unless blocks.

chain: ExecChain Execute chain

begin: Position Begin position

end: Position End position

dest: Position Test position

type: str all or masked

Allowed locations: compiletime


exec_unless_cmp

exec_unless_cmp <chain>, <left>, <op>, <right>

Executes the rest of the chain if the left variable doesn't relate to the right variable using the given operation.

chain: ExecChain Execute chain

left: Variable Left variable

op: str Operator, one of: lt|le|eq|ge|gt

right: Variable Right variable

Allowed locations: compiletime


exec_unless_entity

exec_unless_entity <chain>, <target>

Execute the rest of the chain if no entity is found to match the given selection.

chain: ExecChain Execute chain

target: EntitySelection Entities

Allowed locations: compiletime


exec_unless_nbt_var

exec_unless_nbt_var <chain>, <var>

Executes the rest of the chain if the NBT path to the given variable does not exist. Note that the variable must be backed by NBT.

chain: ExecChain Execute chain

var: Variable NBT Variable

Allowed locations: compiletime


exec_unless_var

exec_unless_var <chain>, <var>, <min>, <max>

Execute the rest of the chain if the given variable is not within the given bounds.

chain: ExecChain Execute chain

var: Variable Variable

min: Opt(int) Minimum value, or NULL for negative infinity

max: Opt(int) Maximum value, or NULL for positive infinity

Allowed locations: compiletime


execute

<ret> = execute

Create a new execute chain.

ret: ExecChain

Allowed locations: preamble

Function Properties

extern

extern

Marks the function as externally visible. The function will not be renamed on name conflict and will not be removed during optimization.

Allowed locations: function preamble


inline

inline

Marks the function as inline-able. invoke calls to this function will result in the body of the function being inserted at the call site

Allowed locations: function preamble


namespace

namespace <namespace>

Sets the function's namespace. By default, a function's namespace is inherited from the datapack definition. This instruction overrides that.

namespace: VirtualString The namespace

Allowed locations: function preamble


pure_func

pure_func

Marks the function as a pure function (i.e. no side-effects). No checks are done to ensure it is side-effect free, allowing for functions with irrelevant side-effects (e.g. caching) to be marked as pure.

Allowed locations: function preamble


run_callback_on_exit

run_callback_on_exit

Converts this function into an async function - one that does not return immediately, but instead invokes a callback when it eventually exits. Call this function with deferred_invoke.

Allowed locations: function preamble

NBT Instructions

entity_local_nbt

<ret> = entity_local_nbt <type>, <target>, <path>

Create an NBT variable that references an entity's NBT

type: VarType Variable type

target: EntityRef Target entity

path: VirtualString NBT path

ret: Variable

Allowed locations: preamble


func_ref

<ret> = func_ref <func>

Create an NBT compound value that refers to the given function. Caveat: The function must be defined before this instruction is used.

func: FunctionLike Function to create a reference to

ret: NBTCompound

Allowed locations: preamble


nbt_assign

nbt_assign <var>, <nbt>

Sets NBT data on the given variable (which must have type 'nbt').

var: Variable Variable to set the value on

nbt: (NBTBase|Variable) NBT value

Allowed locations: runtime code


nbt_compound

<ret> = nbt_compound

Creates a new NBT compound.

ret: NBTCompound

Allowed locations: preamble


nbt_compound_set

nbt_compound_set <var>, <key>, <val>

Sets a key to the given NBT value in a compound tag.

var: NBTCompound Compound to set on

key: VirtualString Key

val: NBTBase Value

Allowed locations: compiletime


nbt_data_getter

<ret> = nbt_data_getter <target>, <path>, <scale>

Creates a command variable that when called, sets the 'result' value to whatever the value at the path is in a block or entity.

target: (BlockRef|EntitySelection) Block or entity to retrieve the value from

path: VirtualString NBT path to the value

scale: Opt(float) Scale the result before returning

ret: CmdFunction

Allowed locations: preamble


nbt_data_merge

nbt_data_merge <target>, <data>

Merge the given NBT compound with a block or entity.

target: (BlockRef|EntityRef) Block or entity to merge with

data: NBTCompound Compound tag holding values to merge into the target

Allowed locations: runtime code


nbt_get_length

<ret> = nbt_get_length <var>

Creates a command variable that when called, sets the 'result' value to the length of this NBT variable (list, compound or string).

var: Variable NBT variable

ret: CmdFunction

Allowed locations: preamble


nbt_list

<ret> = nbt_list <list_type>

Creates a new NBT list of the given element type.

list_type: Opt(NBTType) Type of elements. NULL leaves the list with an unknown type

ret: NBTList

Allowed locations: preamble


nbt_list_append

nbt_list_append <list>, <value>

Appends the given NBT value to an NBT list.

list: NBTList List to append to

value: NBTBase Value to append. The value type must be compatible with the list's element type

Allowed locations: compiletime


nbt_modify_from

nbt_modify_from <target>, <target_path>, <action>, <source>, <source_path>

Modify a block or entity at the given NBT path, performing the given action, choosing the value from a path in another block or entity.

target: (BlockRef|EntitySelection) Block or entity to modify

target_path: VirtualString NBT path to modify

action: str Action, one of: append|insert|merge|prepend|set

source: (BlockRef|EntitySelection) Source entity or block

source_path: VirtualString Path in source

Allowed locations: runtime code


nbt_modify_val

nbt_modify_val <target>, <path>, <action>, <source>

Modify a block or entity at the given NBT path, performing the given action, with the given NBT value.

target: (BlockRef|EntitySelection) Block or entity to modify

path: VirtualString NBT path to modify

action: str Action, one of: append|insert|merge|prepend|set

source: NBTBase Value

Allowed locations: runtime code


nbt_modify_var_from

nbt_modify_var_from <var>, <action>, <source>, <source_path>

Similar to nbt_modify_from except modifies an NBT variable.

var: Variable Variable to modify

action: str Action

source: (BlockRef|EntitySelection) Source entity or block

source_path: (VirtualString|MutableString) Path in source

Allowed locations: runtime code


nbt_remove

nbt_remove <nbtvar>

Removes NBT data associated with an NBT variable. Note that if the variable represents an index into an array, the variable may take on a new value after deleting.

nbtvar: Variable The NBT variable to delete

Allowed locations: runtime code


nbt_serialize

nbt_serialize <dest>, <nbt>

Serializes an NBT tag to a string, sets the given MutableString to the serialized value.

dest: MutableString Destination string

nbt: NBTBase NBT data to serialize

Allowed locations: compiletime


nbt_val

<ret> = nbt_val <type>, <value>

Creates an NBT value of the given NBT type and value.

type: NBTType NBT type

value: (NoneType|float|int|VirtualString) Value of this NBT component. Must be valid for the NBT type

ret: NBTBase

Allowed locations: preamble


nbt_var_append

nbt_var_append <var>, <nbt>

Appends NBT data to the given nbt variable. The variable must point to an NBT list, else it will fail at runtime.

var: Variable Variable to set the value on

nbt: (NBTBase|Variable) NBT value

Allowed locations: runtime code


nbtsubpath

<ret> = nbtsubpath <root>, <path>, <vartype>

Create a derivative NBT variable from a sub-path of a parent NBT variable.

root: Variable Original variable

path: VirtualString subpath

vartype: VarType Type of the variable

ret: Variable

Allowed locations: preamble

Variable Arithmetic Instructions

Variable assign

<var> = <value>

Sets a variable to a given value.

var: Variable Variable to set the value on

value: (int|Variable|float) Value to set


Variable operation

<dest> <op> <src>

Performs an operation on a destination variable using a source value. See /scoreboard for details on each operation.

Valid operations are:

+=

/=

%=

>

<

*=

-=

><

dest: Variable Destination for the operation

src: (int|Variable|float) Source for the operation

Text Instructions

text

<ret> = text

Creates a text object.

ret: TextObject

Allowed locations: preamble


text_append

text_append <text>, <value>

Appends the given value to the text object.

text: TextObject Text to append to

value: (VirtualString|int|Variable|TextObject) Value to append

Allowed locations: compiletime


text_click_action

text_click_action <text>, <action>, <value>

Sets the click action on a text object.

text: TextObject Text object

action: str Action, one of: open_url|open_file|change_page

value: VirtualString Value of the action

Allowed locations: compiletime


text_click_func

text_click_func <text>, <action>, <func>

Sets the click action of a text object to run or suggest a function or command.

text: TextObject Text object

action: str Either run or suggest

func: (FunctionLike|CmdFunction) Function or command

Allowed locations: compiletime


text_send

text_send <text>, <target>

Sends a text object to target players.

text: TextObject Text to send

target: EntitySelection Players to send the text to

Allowed locations: runtime code


text_style

text_style <text>, <prop>, <val>

Sets a style property of a text object.

text: TextObject Text to change the style of

prop: str Style property

val: (str|VirtualString) Style value

Allowed locations: compiletime

Type Constructor Instructions

add_block_prop

add_block_prop <block>, <key>, <value>

Adds a property to the block reference.

block: BlockType Block

key: (VirtualString|str) Property name

value: VirtualString Property value

Allowed locations: compiletime


add_item_prop

add_item_prop <item>, <nbtprop>

Adds an NBT value to the item properties.

item: ItemType Item

nbtprop: NBTCompound NBT value

Allowed locations: compiletime


anc_pos

<ret> = anc_pos <val>

Creates a position component that is relative to the current anchor location (i.e. '^').

val: (float|int) Offset from anchor

ret: AncPosVal

Allowed locations: preamble


block

<ret> = block <block_id>

Creates a block type reference.

block_id: VirtualString ID of the block

ret: BlockType

Allowed locations: preamble


block_pos

<ret> = block_pos <x>, <y>, <z>

Create a block position variable.

x: (int|float|RelPosVal|AncPosVal) X value

y: (int|float|RelPosVal|AncPosVal) Y value

z: (int|float|RelPosVal|AncPosVal) Z value

ret: Position

Allowed locations: preamble


bossbar

<ret> = bossbar <name>, <display>

Creates a bossbar reference.

name: str Bossbar name

display: TextObject Display text

ret: BossbarRef

Allowed locations: global preamble


command

<ret> = command <cmd>

Creates a command variable out of a raw command string.

cmd: VirtualString Raw command string

ret: CmdFunction

Allowed locations: preamble


compileonly

<ret> = compileonly <type>

Creates a local variable of the given variable type.

type: VarType Variable type

ret: Variable

Allowed locations: function preamble


define

<ret> = define <type>

Creates a local variable of the given variable type.

type: VarType Variable type

ret: Variable

Allowed locations: function preamble


entity_local_access

<ret> = entity_local_access <local>, <target>

Creates a variable whose value depends on the objective and target entities.

local: EntityLocal Scoreboard objective

target: EntitySelection Target entities

ret: Variable

Allowed locations: preamble


global

<ret> = global <type>, <linkage>, <namespace>

Creates a global variable of the given variable type.

type: VarType Variable type

linkage: str Linkage (internal|external)

namespace: Opt(VirtualString) Namespace

ret: Variable

Allowed locations: global preamble


item

<ret> = item <item_id>

Creates an item reference.

item_id: VirtualString Item ID

ret: ItemType

Allowed locations: preamble


item_name

<ret> = item_name <item>

Constructs a string containing the given item's name.

item: ItemType Item to get the name of

ret: VirtualString

Allowed locations: preamble


mut_string

<ret> = mut_string <val>

Creates a new mutable string with an optional initial value.

val: Opt(VirtualString) Initial value

ret: MutableString

Allowed locations: preamble


objective

<ret> = objective <name>, <criteria>

Creates a new objective reference, optionally with some criteria.

name: VirtualString Objective name

criteria: Opt(VirtualString) Criteria. If NULL then it will be 'dummy'

ret: EntityLocal

Allowed locations: global preamble


parameter

<ret> = parameter <type>, <passtype>

Add a required parameter of a given type to a function.

type: VarType Parameter type

passtype: str Parameter pass type (byref or byval)

ret: Variable

Allowed locations: function preamble


player_ref

<ret> = player_ref <name>

Creates a reference to a player name.

name: VirtualString Player name

ret: EntityRef

Allowed locations: preamble


position

<ret> = position <x>, <y>, <z>

Create a position variable.

x: (int|float|RelPosVal|AncPosVal) X value

y: (int|float|RelPosVal|AncPosVal) Y value

z: (int|float|RelPosVal|AncPosVal) Z value

ret: Position

Allowed locations: preamble


rel_pos

<ret> = rel_pos <val>

Create a position component that is relative to the sender (i.e. '~').

val: (float|int) Offset from sender

ret: RelPosVal

Allowed locations: preamble


return

<ret> = return <type>

Define a variable to hold a return value of the given type for a function.

type: VarType Return type

ret: Variable

Allowed locations: function preamble


sel_nbt

sel_nbt <sel>, <path>, <val>

Adds an NBT specification to the selector. Candidate entities must have the NBT value specified in the given NBT value.

sel: Selector Selector

path: VirtualString Path to NBT, empty string is the root path

val: NBTBase Value that candidate entities must match

Allowed locations: compiletime


select_score_range

select_score_range <sel>, <score>, <min>, <max>

Adds a score range parameter to the selector.

sel: Selector Selector

score: EntityLocal Score

min: Opt(int) Minimum value, or NULL for negative infinity

max: Opt(int) Maximum value, or NULL for positive infinity

Allowed locations: compiletime


selector

<ret> = selector <type>

Creates a new selector object.

type: SelectorType Type of selector (a|e|s|p|r)

ret: EntitySelection

Allowed locations: preamble


set_block_nbt

set_block_nbt <block>, <nbt>

Sets NBT data to a block reference.

block: BlockType Block

nbt: NBTCompound NBT value

Allowed locations: compiletime


set_selector

set_selector <sel>, <key>, <value>

Sets a selector key to the given value.

sel: Selector Selector

key: str Key

value: VirtualString Value

Allowed locations: compiletime


string_concat

string_concat <dest>, <src>

Appends src onto the mutable string dest. src is copied by value.

dest: MutableString String to modify

src: (MutableString|VirtualString) Source string

Allowed locations: compiletime


team

<ret> = team <name>, <display>

Creates a team reference.

name: str Team name

display: Opt(TextObject) Optional display text

ret: TeamRef

Allowed locations: global preamble

⚠️ **GitHub.com Fallback** ⚠️