Raycast (Entity Condition Type)

Casts a ray to the direction where the entity is looking.

Casts a ray to the direction where the entity is looking.

Type ID: apoli:raycast

Fields

FieldTypeDefaultDescription
distanceFloatoptionalDetermines the maximum distance the ray-cast will travel.
blockBooleantrueDetermines whether the ray-cast should include blocks.
entityBooleantrueDetermines whether the ray-cast should include entities.
shape_typeShape Type"visual"Determines how the ray-cast will handle blocks.
fluid_handlingFluid Handling"any"Determines how the ray-cast will handle fluids.
spaceSpace"world"Determines how the direction will be calculated. Only used if <code>direction</code> is specified.
directionVectoroptionalIf specified, determines the direction of the raycast. Otherwise, defaults to the direction at the entity is facing (as if space is "local".)
match_bientity_conditionBi-entity Condition TypeoptionalIf specified, the entity condition type will check if this bi-entity condition type is fulfilled by either or both the ‘actor’ (the entity being checked by the entity condition type) and ‘target’ (entity that the ray-cast has gone through). If not, the entity will be ignored.
hit_bientity_conditionBi-entity Condition TypeoptionalIf specified, the entity condition type will check if this bi-entity condition type is fulfilled by either or both the ‘actor’ (the entity being checked by the entity condition type) and ‘target’ (the entity that has hit by the ray-cast).
entity_distanceFloatoptionalDetermines the distance of the raycast for entities if entity is set to true. If absent, it will use the higher value between the entity’s attack range (with Reach Entity Attributes compatibility) or the distance field.
block_conditionBlock Condition TypeoptionalIf specified, the entity condition type will check if the block that was hit by the ray-cast fulfills this block condition type.
block_distanceFloatoptionalDetermines the distance of the raycast for blocks if block is set to true. If absent, it will use the higher value between the entity’s block reach (with Reach Entity Attributes compatibility) or the distance field.

Examples

"condition": {
    "type": "apoli:raycast",
    "distance": 6,
    "block": true,
    "entity": true,
    "shape_type": "visual",
    "fluid_handling": "any",
    "match_bientity_condition": {
        "type": "apoli:target_condition",
        "condition": {
            "type": "apoli:entity_type",
            "entity_type": "minecraft:wolf"
        }
    },
    "hit_bientity_condition": {
        "type": "apoli:owner"
    }
}

This example will check if a wolf mob is tamed by the entity that has fired the ray-cast. The ray-cast will ignore tamable mobs other than wolves.