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 raycast will travel.
blockBooleantrueDetermines whether the raycast should include blocks.
entityBooleantrueDetermines whether the raycast should include entities.
shape_typeShape Type"visual"Determines how the raycast will handle blocks.
fluid_handlingFluid Handling"any"Determines how the raycast 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 raycast 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 raycast).
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 raycast 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 raycast. The raycast will ignore tamable mobs other than wolves.