Skip to main content

Raycast (Bi-Entity Condition Type)

Checks whether the target is inside the actor's raycast: a ray cast from the actor's eyes in the direction it is looking, thickened into a beam with radius or widened into a cone with cone_angle. It asks the same question the raycast action answers when it picks which entities to hit, but for one target.

Type ID: apoli:raycast

Fields

FieldTypeDefaultDescription
distanceFloat or ExpressionoptionalHow far the ray reaches. Without it, the ray reaches as far as the actor can hit an entity: its minecraft:player.entity_interaction_range, or 3 for anything without that attribute. entity_distance is accepted as another name.
cone_angleFloat or ExpressionoptionalTurns the ray into a cone. The target passes when its centre is within this many degrees of the aim direction and within distance. It takes the place of radius.
radiusFloat, Vector or ExpressionoptionalThickens the ray into a beam. It takes a number or expression for every axis, or { "x": .., "y": .., "z": .. } with a number or expression in each. The target passes when its hitbox, grown by this much, crosses the ray.
blockBooleantrueWhether blocks between the actor and the target make the condition fail.
shape_typeShape TypevisualWhich block shapes count when block is true.
fluid_handlingFluid HandlinganyWhether fluids count as blocking when block is true.
directionVectoroptionalAims the ray this way instead of where the actor is looking.
spaceSpaceworldHow direction is read.

Other entities never get in the way. Only the target is tested, so a crowd in front of it doesn't hide it. A target standing so close that the actor's eyes are inside its hitbox (or inside its grown box, with radius) always passes.

The numeric fields accept an expression, evaluated against the actor.

Examples

"bientity_condition": {
    "type": "apoli:raycast",
    "distance": 8,
    "cone_angle": 30
}

This passes for a target up to 8 blocks away and within 30 degrees of where the actor is looking, with no wall in between, which suits the area of a breath attack.

"bientity_condition": {
    "type": "apoli:raycast",
    "distance": 20,
    "radius": 0.5,
    "block": false
}

This passes for a target the actor is looking at from up to 20 blocks, through walls, with half a block of leeway around the aim.