Denizen Script Tags


Tags are always written with a <between these marks>, and are critical to scripts, as the primary way to read data.
Learn about how tags work in The Beginner's Guide.


Showing 1 out of 2437 tags...
Name<LocationTag.ray_trace[(range=<#.#>/{200});(return=<{precise}/block/normal>);(default=<{null}/air>);(fluids=<true/{false}>);(nonsolids=<true/{false}>);(entities=<matcher>);(ignore=<entity>|...);(raysize=<#.#>/{0})]>
ReturnsLocationTag
DescriptionTraces a line from this location towards the direction it's facing, returning the location of the first hit block or (optionally) entity.
This tag has also been referred to as 'cursor_on' or 'precise_cursor_on' in the past.
For ray tracing entities, see Tag:LocationTag.ray_trace_target.
Using 'return=normal' instead replaces the old 'precise_impact_normal' tag.
Optionally specify:
range: (defaults to 200) a maximum distance (in blocks) to trace before giving up.
return: (defaults to precise)
specify "precise" to return the exact location of the hit (if it hits a block, returns a location along the edge of the block -- but if it hits an entity, returns a location along the body of the entity)
"normal" to return the normal vector of the impact location,
or "block" to return the location of the block hit (if it hits an entity, returns equivalent to 'precise')
For "precise" and "block", the location's direction is set to the direction of the block face hit (or entity bounding box face), pointing exactly away from whatever was hit (the 'normal' direction).
default: (defaults to "null")
specify "null" to return null when nothing is hit,
or "air" to return the location of the air at the end of the trace (NOTE: can potentially be in water or other ignored block type, not just literal air).
fluids: (defaults to false) specify "true" to count fluids like water as solid, or "false" to ignore them.
nonsolids: (defaults to false) specify "true" to count passable blocks (like tallgrass) as solid, or false to ignore them.
entities: (defaults to none) specify an entity matcher for entities to count as blocking the trace, "*" for any entity counts, or leave off (or empty) to ignore entities.
ignore: (defaults to none) optional list of EntityTags to ignore even if they match the matcher.
raysize: (defaults to 0) sets the radius of the ray being used to trace entities (and NOT for blocks!).
Example
# Destroys whatever solid block the player is looking at.
- define target <player.eye_location.ray_trace[return=block]||null>
- if <[target]> != null:
    - modifyblock <[target]> air
Example
# Spawns a heart wherever the player is looking, no more than 5 blocks away.
- playeffect effect:heart offset:0 at:<player.eye_location.ray_trace[range=5;entities=*;ignore=<player>;fluids=true;nonsolids=true;default=air]>
Example
# Spawns a line of fire starting at the player's target location and spewing out in the direction of the blockface or entity hit, demonstrating the concept of a normal vector.
- define hit <player.eye_location.ray_trace[entities=*;ignore=<player>;fluids=true;nonsolids=true]||null>
- if <[hit]> != null:
    - playeffect effect:flame offset:0 at:<[hit].points_between[<[hit].forward[2]>].distance[0.2]>
Synonyms (Search Aid)locationtag.raycast, locationtag.raytrace, locationtag.ray_cast
Groupworld
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/LocationTag.java#L1718