Skip to main content

Distance From Coordinates (Entity Condition Type)

Compares the distance between the entity and a point, such as the world origin or the world spawn, with a number.

Type ID: apoli:distance_from_coordinates

Fields

FieldTypeDefaultDescription
referenceString"world_origin"The point to measure from: "world_origin" or "world_spawn".
offsetVectoroptionalMoves the reference point by this much.
ignore_xBooleanfalseWhether to treat the X axis as 0.
ignore_yBooleanfalseWhether to treat the Y axis as 0.
ignore_zBooleanfalseWhether to treat the Z axis as 0.
shapeShape"cube"How the distance is measured. "cube" takes the largest axis, "star" adds the axes up, and "sphere" is the straight-line distance. "cone" measures like "sphere", and a hollow shape measures like its solid form.
scale_reference_to_dimensionBooleantrueWhether the reference point takes the dimension's coordinate scale into account.
result_on_the_wrong_dimensionBooleanoptionalWhen set, this is the result whenever the entity isn't in the reference point's dimension.
round_to_digitIntegeroptionalRounds the distance to this many digits after the decimal point. Negative numbers work too, so -2 rounds to multiples of 100.
comparisonComparisonrequiredHow the distance is compared with compare_to.
compare_toFloatrequiredThe number the distance is compared with.

Examples

"condition": {
    "type": "apoli:distance_from_coordinates",
    "offset": {
        "x": 256,
        "y": 64,
        "z": 32
    },
    "shape": "sphere",
    "comparison": "<",
    "compare_to": 8
}

This checks whether the entity is within 8 blocks of the point at X 256, Y 64, Z 32.

"condition": {
    "type": "apoli:distance_from_coordinates",
    "reference": "world_spawn",
    "shape": "cube",
    "ignore_y": true,
    "comparison": "<",
    "compare_to": 4
}

This checks whether the player is within 4 blocks of the world spawn horizontally, measured as a square.