
# -> Advancement
execute if score #or.forging_plate_hit_percentage OverlyRealistic.General.ArbitraryData matches 100.. run \
    advancement grant @s only overly_realistic:advancements/iron_age/forging/shaping_a_better_future

# -> If player has unset power then set power to 0
execute unless score @s OverlyRealistic.Player.UseItem_ForgingHammer_HitPower matches 0.. run \
    scoreboard players set @s OverlyRealistic.Player.UseItem_ForgingHammer_HitPower 0

# -> Tag player
tag @s add OverlyRealistic.Player.HasHitPlateWithForgingHammer

# -> Altitude checks
scoreboard players remove @s[y=150,dy=9999] OverlyRealistic.Player.Stats.Stamina 1
scoreboard players remove @s[y=250,dy=9999] OverlyRealistic.Player.Stats.Stamina 2

# --> Power usages

# -> power 0
execute if score @s OverlyRealistic.Player.UseItem_ForgingHammer_HitPower matches ..1 run \
    return run \
        function overly_realistic:general/custom_blocks/forging_plate/interactions/shaping_tool_forge_process/power_usage/power_0

# -> power 1
execute if score @s OverlyRealistic.Player.UseItem_ForgingHammer_HitPower matches 2 run \
    return run \
        function overly_realistic:general/custom_blocks/forging_plate/interactions/shaping_tool_forge_process/power_usage/power_1

# -> power 2
execute if score @s OverlyRealistic.Player.UseItem_ForgingHammer_HitPower matches 3 run \
    return run \
        function overly_realistic:general/custom_blocks/forging_plate/interactions/shaping_tool_forge_process/power_usage/power_2

# -> power 3
execute if score @s OverlyRealistic.Player.UseItem_ForgingHammer_HitPower matches 4.. run \
    return run \
        function overly_realistic:general/custom_blocks/forging_plate/interactions/shaping_tool_forge_process/power_usage/power_3
