I'm actually losing my mind over this, I've never had this kind of issue with rays and have NO idea why they hit before actually hitting something like I am genuinenly losing my marbles.
on elytra boost:
if regions at player contain "koth":
cancel event
# Prevents 1.21.6> firework boosting whilst looking at a block
set {_ray} to ray trace from player with max distance 4.5
if hit location of {_ray} is set:
line(player's eyes, hit location of {_ray}, ray trace hit block of {_ray})
if ray trace hit block of {_ray} is set:
cancel event
# DEBUG LINES
function line(origin: location, destination: location, hit: block):
force draw 1 rgb(0,0,255) trail particle moving towards {_destination} over 30 seconds at {_destination}
set {_vector} to vector from {_origin} to {_destination}
set {_length} to vector length of {_vector}
set {_loop} to {_length} / 0.1
set vector length of {_vector} to 0.1
loop {_loop} times:
if {_hit} is set:
force draw 1 rgb(255,0,0) trail particle moving towards {_origin} over 30 seconds at {_origin}
else:
force draw 1 rgb(0,255,0) trail particle moving towards {_origin} over 30 seconds at {_origin}
set {_origin} to {_origin} ~ {_vector}```
-# NOTE: Ignore claude in the terminal, I was using it for another script, this code I am sharing is not AI