Entity In Radius (Entity Condition Type)

Counts entities within a specified radius and compares the count against a value.

Counts entities within a specified radius and compares the count against a value. Can filter entities with bi-entity conditions.

Type ID: apoli:entity_in_radius

Fields

FieldTypeDefaultDescription
bientity_conditionBi-entity ConditionoptionalOptional condition to filter counted entities (actor = the entity this condition runs on, target = each nearby entity).
shapeShapecubeDetermines the shape of the area used for checking entities: cube, sphere, star or cone.
radiusFloatrequiredRadius/distance for detection, in blocks.
comparisonComparison>=How to compare the count.
compare_toInteger1The value to compare the count against.

Notes

  • Positions are compared at foot level (entity position = bounding-box minY).
  • The entity the condition runs on is never counted.
  • Without a bientity_condition, all entities in range count (items, projectiles, mobs…). With one, only living entities are tested and counted.
  • The scan stops early as soon as the outcome is decided, so large radius values with a >= comparison stay cheap.

Examples

{
    "type": "apoli:entity_in_radius",
    "bientity_condition": {
        "type": "apoli:target_condition",
        "condition": {
            "type": "apoli:entity_type",
            "entity_type": "minecraft:player"
        }
    },
    "shape": "sphere",
    "radius": 10.0,
    "comparison": ">=",
    "compare_to": 3
}

This example checks if there are at least 3 other players within 10 blocks.