
# -> Tag preparation plate interaction
tag @s add OverlyRealistic.Block.PreparationPlateInteractedWith

# -> If preparation plate has stripped log then set value
execute if entity @s[tag=OverlyRealistic.Block.PreparationPlateHasStrippedLog] run \
    scoreboard players set #or.preparation_plate_has_stripped_log OverlyRealistic.General.ArbitraryData 1

# -> If preparation plate has sharpened stick then set value
execute if entity @s[tag=OverlyRealistic.Block.PreparationPlateHasSharpenedStick] run \
    scoreboard players set #or.preparation_plate_has_sharpened_stick OverlyRealistic.General.ArbitraryData 1

# -> If preparation plate has a special item then set value
execute if entity @s[tag=OverlyRealistic.Block.PreparationPlateHasSpecialItem] run \
    scoreboard players set #or.preparation_plate_has_special_item OverlyRealistic.General.ArbitraryData 1

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

# -> Operate on player
execute on target run \
    function overly_realistic:general/custom_blocks/preparation_plate/player_interact_with_preparation_plate

# --> Interaction types

# -> Craft items
execute if score #or.preparation_plate_interaction_type OverlyRealistic.General.ArbitraryData matches 1 run \
    function overly_realistic:general/custom_blocks/preparation_plate/interactions/int_craft

# -> Specialized item binary tree
execute if score #or.preparation_plate_interaction_type OverlyRealistic.General.ArbitraryData matches 2 run \
    function overly_realistic:general/custom_blocks/preparation_plate/specialized_item_binary_tree

# -> Add item
execute if score #or.preparation_plate_interaction_type OverlyRealistic.General.ArbitraryData matches 3 run \
    function overly_realistic:general/custom_blocks/preparation_plate/interactions/int_add_item_general

# -> Remove items
execute if score #or.preparation_plate_interaction_type OverlyRealistic.General.ArbitraryData matches 4 run \
    function overly_realistic:general/custom_blocks/preparation_plate/preparation_plate_remove_items_from_interaction

# -> Reset values
scoreboard players reset #or.preparation_plate_has_stripped_log OverlyRealistic.General.ArbitraryData
scoreboard players reset #or.preparation_plate_has_special_item OverlyRealistic.General.ArbitraryData
scoreboard players reset #or.preparation_plate_has_sharpened_stick OverlyRealistic.General.ArbitraryData

# -> Untag preparation plate interaction
tag @s remove OverlyRealistic.Block.PreparationPlateInteractedWith
