execute if entity @e[type=item_display,tag=automaton_homing_arrow] run schedule function kiwi2:custom_mobs_fx/automaton/automaton_homing_arrows_tick 1t

execute as @e[type=item_display,tag=automaton_homing_arrow] at @s if entity @p[distance=8..] if predicate kiwi2:chance_random_80 anchored eyes facing entity @a[distance=..50,sort=random,limit=1] eyes positioned ^ ^ ^3 rotated as @s positioned ^ ^ ^4 facing entity @s eyes facing ^ ^ ^-1 positioned as @s run tp @s ^ ^ ^0.6 ~ ~
execute as @e[type=item_display,tag=automaton_homing_arrow] at @s if entity @p[distance=8..] if predicate kiwi2:chance_random_20 anchored eyes facing entity @a[distance=..50,sort=random,limit=1] eyes positioned ^ ^ ^7 rotated as @s positioned ^ ^ ^4 facing entity @s eyes facing ^ ^ ^-1 positioned as @s run tp @s ^ ^ ^0.6 ~ ~
execute as @e[type=item_display,tag=automaton_homing_arrow] at @s if entity @p[distance=..8] anchored eyes facing entity @p[distance=..14,sort=nearest,limit=1] eyes positioned ^ ^ ^3 rotated as @s positioned ^ ^ ^4 facing entity @s eyes facing ^ ^ ^-1 positioned as @s run tp @s ^ ^ ^0.6 ~ ~
execute as @e[type=item_display,tag=automaton_homing_arrow] at @s run particle small_gust ~ ~ ~ 0 0 0 0 2
execute as @e[type=item_display,tag=automaton_homing_arrow] at @s anchored eyes if entity @a[distance=..1.8,sort=random,limit=1] run function kiwi2:custom_mobs_fx/automaton/automaton_arrow_dmg
execute as @e[type=item_display,tag=automaton_homing_arrow] at @s unless block ~ ~ ~ #replaceable run function kiwi2:custom_mobs_fx/automaton/automaton_arrow_hit_block