Area Of Effect (Entity Action Type)

Executes a Bi-Entity Action within a specified radius.

Executes a Bi-Entity Action within a specified radius.

Type ID: apoli:area_of_effect

In the context of this entity action type, the ’actor’ is the entity that invoked the action and the ’target(s)’ is/are the entity/entities within the specified radius.

Fields

FieldTypeDefaultDescription
radiusVector16.0The size of the area — a single number (uniform on all axes) or {"x":.., "y":.., "z":..} for independent per-axis extents.
shapeShape"cube"The outline of the area: cube, sphere, star, or cone.
bientity_actionBi-entity Action TypeoptionalThe bi-entity action to execute on either or both the ’actor’ or the ’target(s)’. Leave it out to count matches without doing anything to them.
bientity_conditionBi-entity Condition TypeoptionalIf specified, the specified bi-entity action will only be executed on either or both the ’actor’ or ’target(s)’ that fulfill this bi-entity condition.
include_actorBooleanfalseDetermines whether the ’actor’ should be included as a target.
after_actionEntity Action TypeoptionalRun once on the ’actor’ after the sweep, with count bound to how many entities matched.
offsetVector0.0Moves the centre of the area away from the ’actor’ by this much before the sweep runs.
spaceSpace"world"The frame offset is read in. "local" follows the actor’s full look direction; "local_horizontal_normalized" follows only their yaw, keeping y as world-up.

Counting what it found

Two Expression variables are bound while this action runs:

  • count — how many entities matched. Available in bientity_action and in after_action.
  • index — the zero-based iteration number, in bientity_action only.

That turns “how many mobs are near me?” into a number you can store, instead of an if_else_list of hard-coded bands:

"entity_action": {
  "type": "apoli:area_of_effect",
  "radius": 8,
  "shape": "sphere",
  "bientity_condition": {
    "type": "apoli:target_condition",
    "condition": {
      "type": "apoli:living"
    }
  },
  "after_action": {
    "type": "apoli:modify_resource",
    "resource": "example:nearby",
    "modifier": {
      "operation": "set_base",
      "value": "count"
    }
  }
}

With bientity_action omitted, nothing happens to the entities themselves — the sweep is only there to produce count.

Putting the area somewhere else

By default the sweep is centred on the actor. offset moves that centre, and space says which way the offset points — so a small sphere placed a few blocks along the player’s look is a “grab what is in front of my face” check, without the single-ray limits of apoli:raycast:

"entity_action": {
  "type": "apoli:area_of_effect",
  "shape": "sphere",
  "radius": 1.5,
  "offset": {
    "x": 0,
    "y": 1.5,
    "z": 2.5
  },
  "space": "local_horizontal_normalized",
  "bientity_action": {
    "type": "apoli:grab"
  }
}

local_horizontal_normalized rotates the offset by the actor’s yaw only, so z is “forward” and y stays world-up — the sphere sits in front of the player’s head and does not dive into the floor when they look down. Use "local" instead when the area should follow pitch as well.

Examples

"entity_action": {
    "type": "apoli:area_of_effect",
    "radius": 10,
    "shape": "sphere",
    "bientity_action": {
        "type": "apoli:target_action",
        "action": {
            "type": "apoli:spawn_entity",
            "entity_type": "minecraft:lightning_bolt"
        }
    }
}

This example will summon a lightning bolt on entities within a 10 block spherical radius.

"entity_action": {
    "type": "apoli:area_of_effect",
    "radius": 32,
    "bientity_action": {
        "type": "apoli:target_action",
        "action": {
            "type": "apoli:set_on_fire",
            "duration": 5
        }
    },
    "bientity_condition": {
        "type": "apoli:can_see"
    }
}

This example will set entities within a 32 block radius on fire for 5 seconds if the entities that are within the radius can be “seen” by the entity that invoked the action.

"entity_action": {
  "type": "apoli:area_of_effect",
  "shape": "cube",
  "radius": {
    "x": 12,
    "y": 3,
    "z": 12
  },
  "bientity_action": {
    "type": "apoli:target_action",
    "action": {
      "type": "apoli:set_on_fire",
      "duration": 3
    }
  }
}

This example gives radius a per-axis vector to make a wide, flat 25×7×25 slab (12 out on each horizontal axis, only 3 up/down) — a ground-hugging area effect instead of a full cube.