# Normal inv update managed by the advancement inv_update


# Trigger after death since advancement system gets stuck
execute as @s[scores={inv_death=1..},nbt={Health:20.0f}] run function items:stats_calc/0_schedule
scoreboard players set @s[scores={inv_death=1..},nbt={Health:20.0f}] inv_death 0

# Selected items stats
scoreboard players set tmp selected_item 0
execute if predicate items:selected/weapon store result score tmp selected_item run data get entity @s SelectedItem.tag.item_uuid 1
execute unless score @s selected_item = tmp selected_item run function items:stats_calc/0_schedule
scoreboard players operation @s selected_item = tmp selected_item

# HP changed (player hp items)
execute unless score @s previous_hp = @s display_hp run function items:stats_calc/0_schedule
scoreboard players operation @s previous_hp = @s display_hp
