This function pack is an editable raycasting template. It allows you to run your desired commands when your targets look at entities, blocks, or specific block faces.

Contributors

This work is licensed under the MIT License.

Usage Commands

/execute as <target> run function wiki/raycast/initiate

Initiate raycast from the desired target.

Editable Files

functions/wiki/raycast/on_hit/

All files in this folder are editable in the same way (commands will execute when the target looks at blocks or specific block faces).
Note: Using @s here will execute as the caster (the target from whose sight the ray is being cast). If you want to target a different entity, you can use selectors like @e or @p.

functions/wiki/raycast/on_hit/entity.mcfunction

Commands in this file will run when the target is looking at an entity.
Note: Using @s here will execute as the entity that was looked at, not the caster. If you want to target the caster, use @p instead.