
# -> Tag block
tag @s add OverlyRealistic.Block.WoodenRack_InteractedWith

# -> Reset interaction type
scoreboard players set #or.wooden_rack_interaction_type OverlyRealistic.General.ArbitraryData 0

# -> If rack has gory hide then set value
scoreboard players set #or.wooden_rack_has_gory_hide OverlyRealistic.General.ArbitraryData 0
execute if entity @s[tag=OverlyRealistic.Block.WoodenRack_Status_Filled_Item_GoryHide] run \
    scoreboard players set #or.wooden_rack_has_gory_hide OverlyRealistic.General.ArbitraryData 1

# -> Function call
execute on target at @s run \
    function overly_realistic:general/custom_blocks/wooden_rack/player_interact_with_rack

# --> Interaction types

# -> Drop items
execute if score #or.wooden_rack_interaction_type OverlyRealistic.General.ArbitraryData matches 3 \
    if entity @s[tag=OverlyRealistic.Block.WoodenRack_Status_Filled] \
    align xyz \
    positioned ~0.5 ~1.5 ~0.5 run \
        function overly_realistic:general/custom_blocks/wooden_rack/drop_current_item_filled_rack

# -> Scrape gory hide
execute if score #or.wooden_rack_interaction_type OverlyRealistic.General.ArbitraryData matches 5 \
    align xyz \
    positioned ~0.5 ~1.5 ~0.5 run \
        function overly_realistic:general/custom_blocks/wooden_rack/interactions/gory_hide/scrape_gory_hide

# -> Apply wood
#execute if score #or.wooden_rack_interaction_type OverlyRealistic.General.ArbitraryData matches 1 \
    align xyz \
    positioned ~0.5 ~1.5 ~0.5 run \
        function overly_realistic:general/custom_blocks/wooden_rack/interactions/apply_wood

# -> Apply doused hide
execute if score #or.wooden_rack_interaction_type OverlyRealistic.General.ArbitraryData matches 6 \
    align xyz \
    positioned ~0.5 ~1.5 ~0.5 run \
        function overly_realistic:general/custom_blocks/wooden_rack/interactions/apply_doused_hide

# -> Apply hide
execute if score #or.wooden_rack_interaction_type OverlyRealistic.General.ArbitraryData matches 2 \
    align xyz \
    positioned ~0.5 ~1.5 ~0.5 run \
        function overly_realistic:general/custom_blocks/wooden_rack/interactions/apply_hide

# -> Apply gory hide
execute if score #or.wooden_rack_interaction_type OverlyRealistic.General.ArbitraryData matches 4 \
    align xyz \
    positioned ~0.5 ~1.5 ~0.5 run \
        function overly_realistic:general/custom_blocks/wooden_rack/interactions/gory_hide/apply_gory_hide

# -> Untag block
tag @s remove OverlyRealistic.Block.WoodenRack_InteractedWith
