
# -> Add to break value
scoreboard players add @s OverlyRealistic.General.ArbitraryData 1

# -> If player is using a tool then add to value
scoreboard players set #or.player_is_using_tool_for_heated_bloom OverlyRealistic.General.ArbitraryData 0
execute on target \
    if items entity @s weapon.mainhand #overly_realistic:faster_at_breaking_heated_bloom run \
        scoreboard players set #or.player_is_using_tool_for_heated_bloom OverlyRealistic.General.ArbitraryData 1
execute if score #or.player_is_using_tool_for_heated_bloom OverlyRealistic.General.ArbitraryData matches 1 run \
    scoreboard players add @s OverlyRealistic.General.ArbitraryData 2

# -> Clamp
scoreboard players set @s[scores={OverlyRealistic.General.ArbitraryData=101..}] OverlyRealistic.General.ArbitraryData 100

# -> Globalize value
scoreboard players operation #or.heated_bloom_break_value OverlyRealistic.General.ArbitraryData = @s OverlyRealistic.General.ArbitraryData

# -> Sound
playsound block.calcite.break block @a ~ ~ ~ 0.7 1.3

# -> Particle
particle dust{color:[0.000,0.000,0.000],scale:2} ~ ~-0.25 ~ 0.2 0.2 0.2 0.01 1 normal @a

# -> Display value to player
execute on target run \
    function overly_realistic:general/custom_blocks/heated_bloom/heated_bloom_breaking_value_display

# -> If value < 100 then return
execute unless score @s OverlyRealistic.General.ArbitraryData matches 100.. run \
    return fail

# -> Drop heated wrought iron
loot spawn ~ ~ ~ loot overly_realistic:blocks/heated_wrought_iron

# -> Sound
playsound block.calcite.break block @a ~ ~ ~ 0.9 2
playsound block.stone.break block @a ~ ~ ~ 0.5 1.3

# -> Remove bloom
execute on passengers run \
    kill @s
kill @s
