onyx.execute

class onyx.execute.BaseCondition(parent, prefix)

BaseCondition - execute if and execute unless commands

Parameters
  • parent (Execute) – The Execute object

  • prefix (str) – if or unless

block(position, value)

block - Checks if a block is of a certain type

Parameters
  • position (Vector3) – The position to check

  • value (str) – The block to check at the position

Returns

The parent object

Return type

Execute

blocks(corner_1, corner_2, end_location, mask=False)

blocks - Checks the status of a selection of blocks

Parameters
  • corner_1 (Vector3) – The first corner of the selection

  • corner_2 (Vector3) – The second corner of the selection

  • end_location (Vector3) – The first corner of the area being checked

  • mask (bool) – Whether or not air should be ignored in the selection

Returns

The parent object

Return type

Execute

data(source)

data - Checks if a data path exists

Parameters

source (DataSource) – The data source to check

Returns

The parent object

Return type

Execute

entity(target)

entity - Checks if an entity exists

Parameters

target (Selector) – The entity to check

Returns

The parent object

Return type

Execute

predicate(predicate)

predicate - Checks if a predicate is true

Parameters

predicate (Union[Predicate, str]) – The predicate to check

Returns

The parent object

Return type

Execute

score(expression)

score - Checks if a score matches criteria

Parameters

expression (Expression) – The expression to check. Created by using a conditional operator on a Player object.

Returns

The parent object

Return type

Execute

class onyx.execute.If(parent)

If - Provides synactic sugar for execute if commands

Parameters

parent (Execute) – The Execute object

class onyx.execute.Unless(parent)

Unless - Provides synactic sugar for execute unless commands

Parameters

parent (Execute) – The Execute object

class onyx.execute.BaseStore(parent, prefix)

BaseStore - execute store result and execute store success commands

Parameters
  • parent (Execute) – The Execute object

  • prefix (str) – result or success

block(source)

block - Stores data in a block

Parameters

source (StoreTarget) – The data location to store the data in

Returns

The parent object

Return type

Execute

bossbar(source)

bossbar - Stores data in a bossbar

Parameters

source (StoreTarget) – The data location to store the data in

Returns

The parent object

Return type

Execute

entity(source)

entity - Stores data in a entity

Parameters

source (StoreTarget) – The data location to store the data in

Returns

The parent object

Return type

Execute

score(target)

score - Stores data in a scoreboard player

Parameters

source (StoreTarget) – The data location to store the data in

Returns

The parent object

Return type

Execute

storage(source)

storage - Stores data in storage

Parameters

source (StoreTarget) – The data location to store the data in

Returns

The parent object

Return type

Execute

class onyx.execute.Result(parent)

Result - Provides synactic sugar for execute store result commands

Parameters

parent (Execute) – The Execute object

class onyx.execute.Success(parent)

Success - Provides synactic sugar for execute store success commands

Parameters

parent (Execute) – The Execute object

class onyx.execute.Store(parent)

Store - Provides synactic sugar for execute store commands. Only purpose is to provide a delimeter between execute and result or ``success`.

Parameters

parent (Execute) – The Execute object

class onyx.execute.Execute(context=None)

Execute - Represents an execute command

Parameters

context (str, optional) – Context can be provided manually if you don’t want to construct it with method chaining. Do not include the execute keyword. Example: "if entity @s". Defaults to None.

run(command)

run - Runs a command in the context specified by the Execute object

Parameters

command (Union[Function, str]) – The command to be run

Returns

Returns an execute command. Does not return self as no more method chaining should be done after this.

Return type

str

align(axes)

align - Aligns on the specified axes

Parameters

axes (Union[axis, tuple]) – The axes to align the command on. You can specify a single axis, or multiple axes in a list or tuple.

Returns

The current object

Return type

self

anchored(anchor)

anchored - Anchors on the eyes or feet of an entity

Parameters

anchor (anchor) – The anchor to be used

Returns

The current object

Return type

self

as_(targets)

as_ - Executes as the specified entity/entities

Parameters

targets (Selector) – The entity/entities to execute as

Returns

The current object

Return type

self

at(targets)

at - Executes at the specified entity/entities

Parameters

targets (Selector) – The entity/entities to execute at

Returns

The current object

Return type

self

as_at(targets)

as_at - Executes as AND at the specified entity/entities. Turns into as <entity> at @s.

Parameters

targets (Selector) – The entity/entities to execute as and at

Returns

The current object

Return type

self

facing(target, anchor=anchor.eyes)

facing - Executes facing the specified entity or location

Parameters
  • target (Union[Selector, Vector3]) – The entity or location to face

  • anchor (anchor, optional) – The anchor to use (eyes, feet). Defaults to anchor.eyes.

Returns

The current object

Return type

self

in_(dimension)

in_ - Executes in a dimension

Parameters

dimension (dimension) – The dimension to execute in

Returns

The current object

Return type

self

positioned(position)

positioned - Changes the position of the execution context

Parameters

position (Union[Vector3, Selector]) – The location to execute at

Returns

The current object

Return type

self

rotated(rotation)

rotated - Changes the rotation of the execution context

Parameters

rotation (Union[Vector2, Selector]) – The rotation/entity to execute at

Returns

The current object

Return type

self

build()
Returns

The full execute chain as a string

Return type

str