
# -> Sound
playsound minecraft:block.grindstone.use block @a ~ ~ ~ 1 1.2

# -> On RNG, decrease stamina
execute if predicate overly_realistic:world/campfire/stamina_decrease_rng run \
    scoreboard players remove @s OverlyRealistic.Player.Stats.Stamina 1

# -> Particle
particle smoke ~0.5 ~0.5 ~0.5 0.25 0.25 0.25 0.01 3 normal @a

# -> On RNG fail, return
execute unless score @s OverlyRealistic.Player.WisdomStats.Blacksmithing matches 2.. \
    unless predicate overly_realistic:world/campfire/light_campfire_rng run \
        return fail
execute if score @s OverlyRealistic.Player.WisdomStats.Blacksmithing matches 2.. \
    unless predicate overly_realistic:world/forging/forge_tool_on_anvil_rng run \
        return fail

# -> Intelligence gain RNG
execute if predicate overly_realistic:player/misc/intelligence_gain_general_rng run \
    function overly_realistic:players/intelligence/add_1_intelligence

# -> Sharpen tool
execute if items entity @s[scores={OverlyRealistic.Player.WisdomStats.Blacksmithing=0}] weapon.mainhand iron_sword[custom_data~{current_process:"forged"}] run \
    item modify entity @s weapon.mainhand overly_realistic:forgery/iron_sword/iron_tool_forge_sharp
execute if items entity @s[scores={OverlyRealistic.Player.WisdomStats.Blacksmithing=1}] weapon.mainhand iron_sword[custom_data~{current_process:"forged"}] run \
    item modify entity @s weapon.mainhand overly_realistic:forgery/iron_sword/iron_tool_forge_sharp_1
execute if items entity @s[scores={OverlyRealistic.Player.WisdomStats.Blacksmithing=3}] weapon.mainhand iron_sword[custom_data~{current_process:"forged"}] run \
    item modify entity @s weapon.mainhand overly_realistic:forgery/iron_sword/iron_tool_forge_sharp_2

# -> Increase blacksmithing XP
function overly_realistic:players/wisdom/blacksmithing/add_to_skill_xp_c_sharpen_equipment