
# -> Reset adv trigger
advancement revoke @s only overly_realistic:items/crop_additions/use_compost

# -> Add to value
scoreboard players add @s OverlyRealistic.Player.UseItem_Compost 1

# -> Unless item usage >= 20 then return
execute unless score @s OverlyRealistic.Player.UseItem_Compost matches 20.. run \
    return fail

# -> Reset value
scoreboard players reset @s OverlyRealistic.Player.UseItem_Compost

# -> Set raycast range
scoreboard players reset @s OverlyRealistic.Player.LocalRayRange
execute store result score @s OverlyRealistic.Player.LocalRayRangeMax run \
    attribute @s block_interaction_range get 10

# -> Raycast to farmland
execute anchored eyes \
    positioned ^ ^ ^ \
    anchored feet run \
        function overly_realistic:players/items/crop_additions/compost/raycast_travel
