
# -> If hide is scraped then return
execute if entity @s[tag=OverlyRealistic.Block.GoryHide_IsScrapedHide] run \
    return fail

# -> If player is not holding an item that is able to scrape hide then return
execute on target \
    unless function overly_realistic:general/custom_blocks/gory_hide/player_interact_with_gory_hide run \
        return fail

# -> Sound
playsound item.armor.equip_leather block @a ~ ~ ~ 0.5 2
playsound minecraft:block.honey_block.slide block @a ~ ~ ~ 0.5 2

# -> Particle
particle block{block_state:"redstone_block"} ~ ~ ~ 0.2 0.2 0.2 0.001 1 normal @a

# -> Add to scrape value
scoreboard players add @s OverlyRealistic.General.ArbitraryData 3

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

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

# -> Display scrape value
execute on target run \
    function overly_realistic:general/custom_blocks/gory_hide/player_view_scrape_value

# -> If cap has not been reached then return
execute unless score @s OverlyRealistic.General.ArbitraryData matches 100.. run \
    return fail

# -> Set scraped tag
tag @s add OverlyRealistic.Block.GoryHide_IsScrapedHide

# -> Set item
function overly_realistic:general/custom_blocks/gory_hide/gory_hide_scrape_hide with entity @s data
