Selector Action (Entity Action Type)

Executes an action on entities selected by a target selector.

Executes an action on entities selected by a target selector.

Type ID: apoli:selector_action

!!! note

See Minecraft Wiki: Target selectors for more information about target selectors.

!!! note

This entity action type has a bi-entity action context, where the ’actor’ entity is the entity that invoked the entity action while the ’target’ entities are the entities that were selected by the specified selector.

Fields

FieldTypeDefaultDescription
selectorStringThe selector to use for selecting entities. It can be the username of a player, the UUID of the entity or a target selector.
bientity_actionBi-entity Action TypeoptionalIf specified, this action will be executed on either or both the ’actor’ and ’target’ entities.
bientity_conditionBi-entity Condition TypeoptionalIf specified, the specified action will only be executed if this condition is fulfilled by either or both the ’actor’ and ’target’ entities.

Examples

"entity_action": {
    "type": "apoli:selector_action",
    "selector": "Steve",
    "bientity_action": {
        "type": "apoli:damage",
        "amount": 5,
        "damage_type": "minecraft:generic"
    }
}

This example will deal 2 and a half hearts of damage to the player named Steve.

"entity_action": {
    "type": "apoli:selector_action",
    "selector": "@e[type = minecraft:armor_stand, tag = some_tag]",
    "bientity_action": {
        "type": "apoli:target_action",
        "action": {
            "type": "apoli:execute_command",
            "command": "kill @s"
        }
    }
}

This example will kill armor stands that have the some_tag tag (added via the /tag command)