
# --> Interaction checks

# -> If the player is shifting then remove items
execute if score @s OverlyRealistic.PredicateValue.IsSneaking matches 1 run \
    return run \
        scoreboard players set #or.remove_items_from_forging_plate OverlyRealistic.General.ArbitraryData 1

# -> If player does not have any items on him then return
execute unless items entity @s weapon.mainhand * run \
    return fail

# -> Store currently used item
item replace entity 00000001-0000-002b-0000-00010000002b contents from entity @s weapon.mainhand

# -> Use forging hammer
execute if items entity @s weapon.mainhand *[custom_data~{IsForgingHammer:1b}] run \
    return run \
        scoreboard players set #or.player_used_forging_hammer OverlyRealistic.General.ArbitraryData 1

# -> If player is not placing a valid item then return
execute unless items entity @s weapon.mainhand *[custom_data~{or_is_tool:1b}] run \
    return fail

# -> Cap item amount
data modify entity 00000001-0000-002b-0000-00010000002b item.count set value 1

# -> Add items
scoreboard players set #or.player_placed_item_on_forging_plate OverlyRealistic.General.ArbitraryData 1
