
# -> Get first compound
data modify storage overly_realistic:player_attributes temp_attribute set from storage overly_realistic:player_attributes local_pre_death_attributes[0]

# -> Get amount of modifiers
scoreboard players set #or.attribute_modifier_amount OverlyRealistic.General.ArbitraryData 0
execute store result score #or.attribute_modifier_amount OverlyRealistic.General.ArbitraryData run \
    data get storage overly_realistic:player_attributes temp_attribute.modifiers

# -> If this attribute has modifiers then apply them
execute if score #or.attribute_modifier_amount OverlyRealistic.General.ArbitraryData matches 1.. run \
    function overly_realistic:general/downing/attribute_restoration/attribute_modifier_get

# -> Remove current attribute entry
data remove storage overly_realistic:player_attributes local_pre_death_attributes[0]

# -> Get amount of attribute entries left
scoreboard players set #or.attribute_modifier_amount OverlyRealistic.General.ArbitraryData 0
execute store result score #or.attribute_modifier_amount OverlyRealistic.General.ArbitraryData run \
    data get storage overly_realistic:player_attributes local_pre_death_attributes

# -> If there are still attribute entries left then loop recursivelly
execute if score #or.attribute_modifier_amount OverlyRealistic.General.ArbitraryData matches 1.. run \
    function overly_realistic:general/downing/attribute_restoration/restoration_loop