Skip to main content

Command (Entity Condition Type)

Runs a command and compares its result with a number.

Type ID: apoli:command

warning

This condition only works on the server, so it can't be used in fields that are evaluated on the client.

Fields

FieldTypeDefaultDescription
commandStringrequiredThe command to run.
comparisonComparisonrequiredHow the command's result, an integer, is compared with compare_to.
compare_toIntegerrequiredThe number the result is compared with.

Examples

"condition": {
    "type": "apoli:command",
    "command": "execute if score @s objective1 = @s objective2",
    "comparison": "==",
    "compare_to": 1
}

This checks whether the entity has the same score in the objective1 and objective2 scoreboard objectives.

"condition": {
    "type": "apoli:command",
    "command": "execute if entity @e[type = #minecraft:skeletons, distance = ..64]",
    "comparison": ">=",
    "compare_to": 4
}

This checks whether there are 4 or more entities from the #minecraft:skeletons entity type tag (data/minecraft/tags/entity_types/skeletons.json) within 64 blocks of the entity.