
# -> Tag forging plate
tag @s add OverlyRealistic.Block.ForgingPlateInteractedWith

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

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

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

# -> Interaction call
execute on target at @s run \
    function overly_realistic:general/custom_blocks/forging_plate/player_interact_with_forging_plate

# -> If player used a forging hammer then operate
execute if score #or.player_used_forging_hammer OverlyRealistic.General.ArbitraryData matches 1 \
    if block ~ ~-1 ~ #anvil \
    unless block ~ ~ ~ #overly_realistic:forging_plate/is_hot_block \
    unless block ~ ~ ~ #overly_realistic:forging_plate/is_cool_block run \
        function overly_realistic:general/custom_blocks/forging_plate/interactions/int_use_forging_hammer

# -> If player shift clicked then remove items
execute if score #or.remove_items_from_forging_plate OverlyRealistic.General.ArbitraryData matches 1 run \
    function overly_realistic:general/custom_blocks/forging_plate/interactions/int_remove_all_items

# -> If player placed item then operate
execute if score #or.player_placed_item_on_forging_plate OverlyRealistic.General.ArbitraryData matches 1 run \
    function overly_realistic:general/custom_blocks/forging_plate/interactions/int_add_item_general

# -> Untag forging plate
tag @s remove OverlyRealistic.Block.ForgingPlateInteractedWith
