
# -> Add to knife usage
scoreboard players add @s OverlyRealistic.General.ArbitraryData 8
execute if items entity 00000001-0000-002b-0000-00010000002b contents *[custom_data~{or_tool_material:"copper"}] run \
    scoreboard players add @s OverlyRealistic.General.ArbitraryData 4
execute if items entity 00000001-0000-002b-0000-00010000002b contents *[custom_data~{or_tool_material:"iron"}] run \
    scoreboard players add @s OverlyRealistic.General.ArbitraryData 8

# -> Cap value
execute if score @s OverlyRealistic.General.ArbitraryData matches 101.. run \
    scoreboard players set @s OverlyRealistic.General.ArbitraryData 100

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

# -> Display knife usage value to player
execute on target run \
    function overly_realistic:general/custom_blocks/cooking_board/interaction_types/player_display_knife_usage

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

# -> Reset success
scoreboard players set #or.knife_usage_success OverlyRealistic.General.ArbitraryData 0

# -> Set item drops
execute on passengers \
    if entity @s[tag=OverlyRealistic.Block.CookingBoard_Item] run \
        function overly_realistic:general/custom_blocks/cooking_board/interaction_types/board_item_drop_from_knife_usage

# -> Advancement
execute if score #or.knife_usage_success OverlyRealistic.General.ArbitraryData matches 1 \
    on target run \
        advancement grant @s only overly_realistic:advancements/stone_age/fishy_business

# -> Reset data
function overly_realistic:general/custom_blocks/cooking_board/cooking_board_reset_data
