
# -> Add to time
scoreboard players add @s OverlyRealistic.Player.UseItem_SharpenedFlint_SharpenStickTime 1

# -> If not max then return
execute unless score @s OverlyRealistic.Player.UseItem_SharpenedFlint_SharpenStickTime matches 15.. run \
    return fail

# -> Particles
execute anchored eyes run \
    particle item{item:"stick"} ^ ^ ^0.4 0 0 0 0.01 3 normal @a

# -> Sound
playsound block.wood.break block @a ~ ~ ~ 0.35 2

# -> Add to success time
scoreboard players add @s OverlyRealistic.Player.UseItem_SharpenedFlint_SharpenStickSuccesses 1

# -> Reset usage time
scoreboard players reset @s OverlyRealistic.Player.UseItem_SharpenedFlint_SharpenStickTime

# -> If not max successes then return
execute unless score @s OverlyRealistic.Player.UseItem_SharpenedFlint_SharpenStickSuccesses matches 10.. run \
    return fail

# -> Sound
playsound block.wood.place block @a ~ ~ ~ 0.35 2

# -> Reset successes
scoreboard players reset @s OverlyRealistic.Player.UseItem_SharpenedFlint_SharpenStickSuccesses

# -> Advancement
advancement grant @s only overly_realistic:advancements/stone_age/the_pillar_of_war

# -> If player has a stick in their mainhand then operate
execute if items entity @s weapon.mainhand stick run \
    return run \
        function overly_realistic:players/items/sharpened_flint/sharpened_stick/operate_on_item_in_mainhand

# -> If count = 1 then set the item
execute if items entity @s weapon.offhand stick[count=1] run \
    return run \
        loot replace entity @s weapon.offhand loot overly_realistic:items/sharpened_stick

# -> Remove one item
item modify entity @s weapon.offhand overly_realistic:multipurpose/remove_one_item

# -> Give sharpened stick
loot give @s loot overly_realistic:items/sharpened_stick
