## Increment the Raycast score on every iteration so we can stop before hitting 300
scoreboard players add @s Raycast 1

## Checks if the path ahead is clear, and then teleports forward if so
tp @s[scores={Raycast=..30}] ^ ^ ^1

event entity @e[type=ldz:tutorial_enderman,r=3] minecraft:become_angry

# particle minecraft:endrod ~ ~1.5 ~

## Recursively call this function as long as the path is still clear and we haven't done more than 300 raycast iterations
execute as @s[scores={Raycast=..30}] run function tutorial/anger_raycast