
# -> Add to value
scoreboard players add @s OverlyRealistic.World.PreparationPlateSharpenSharpenedStick 2

# -> Tool-dependent additions to CutLog value
execute if items entity 00000001-0000-002b-0000-00010000002b contents #overly_realistic:prep_plate_sp_sharpen_tool_0 run \
    scoreboard players add @s OverlyRealistic.World.PreparationPlateSharpenSharpenedStick 2
execute if items entity 00000001-0000-002b-0000-00010000002b contents #overly_realistic:prep_plate_sp_sharpen_tool_1 run \
    scoreboard players add @s OverlyRealistic.World.PreparationPlateSharpenSharpenedStick 4

# -> Sound
playsound block.bamboo_wood.break block @a ~ ~ ~ 0.6 2

# -> Particle
particle item{item:"stick"} ~ ~ ~ 0.15 0.05 0.15 0.001 5 normal @a

# -> Clamp value
scoreboard players set @s[scores={OverlyRealistic.World.PreparationPlateSharpenSharpenedStick=101..}] OverlyRealistic.World.PreparationPlateSharpenSharpenedStick 100

# -> Copy current value to global value to show it to the player
scoreboard players operation #or.sp_sharpen_value OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.World.PreparationPlateSharpenSharpenedStick

# -> Show player progress
execute on target run \
    function overly_realistic:general/custom_blocks/preparation_plate/interactions/int_sharpen_sp_subtitle

# -> If SharpenSp < max then return
execute unless score @s OverlyRealistic.World.PreparationPlateSharpenSharpenedStick matches 100.. run \
    return fail

# -> Reset SharpenSp
scoreboard players reset @s OverlyRealistic.World.PreparationPlateSharpenSharpenedStick

# -> Sound
playsound block.bamboo_wood.break block @a ~ ~ ~ 0.5 2
playsound block.bamboo_wood.break block @a ~ ~ ~ 0.5 0

# -> Particle
particle item{item:"stick"} ~ ~ ~ 0.15 0.05 0.15 0.001 10 normal @a

# -> Advancement
execute on target run \
    advancement grant @s only overly_realistic:advancements/stone_age/the_pillar_of_death

# -> Sharpen SP into spear
function overly_realistic:general/custom_blocks/preparation_plate/interactions/sharpened_stick/create_spear
