
# -> Remove tag
tag @s remove OverlyRealistic.Player.InventoryChanged

# -> Get amount of items in inventory
#execute store result score #or.inventory_item_amount OverlyRealistic.General.ArbitraryData run \
    clear @s * 0

# -> Get amount of edited items in inventory
#execute store result score #or.inventory_item_amount_edited OverlyRealistic.General.ArbitraryData run \
    clear @s *[custom_data~{or_edited_item:1b}] 0

# -> If total items = total amount of edited items then return
#execute if score #or.inventory_item_amount OverlyRealistic.General.ArbitraryData = #or.inventory_item_amount_edited OverlyRealistic.General.ArbitraryData run \
    return fail

# -> If player has debug tag then return
execute if entity @s[tag=Debug.NoItemEdit] run \
    return fail

# -> Edit offhand items if there are any
execute if items entity @s weapon.offhand *[!custom_data] run \
    function overly_realistic:general/items/player/inv_slots/misc/edit_offhand

# -> Edit hotbar items if there are any
execute if items entity @s hotbar.* *[!custom_data] run \
    function overly_realistic:general/items/player/hotbar_detection

# -> Edit inventory items if there are any
execute if items entity @s inventory.* *[!custom_data] run \
    function overly_realistic:general/items/player/inventory_detection
