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
| Field | Type | Default | Description |
|---|---|---|---|
distance | Float | optional | Determines the maximum distance the raycast will travel. |
block | Boolean | true | Determines whether the raycast should include blocks. |
entity | Boolean | true | Determines whether the raycast should include entities. |
shape_type | Shape Type | "visual" | Determines how the raycast will handle blocks. |
fluid_handling | Fluid Handling | "any" | Determines how the raycast will handle fluids. |
space | Space | "world" | Determines how the direction will be calculated. Only used if <code>direction</code> is specified. |
direction | Vector | optional | If specified, determines the direction of the raycast. Otherwise, defaults to the direction at the entity is facing (as if space is "local".) |
match_bientity_condition | Bi-entity Condition Type | optional | If 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_condition | Bi-entity Condition Type | optional | If 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_distance | Float | optional | Determines 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_condition | Block Condition Type | optional | If specified, the entity condition type will check if the block that was hit by the raycast fulfills this block condition type. |
block_distance | Float | optional | Determines 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.