
# -> 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 there are no more attribute modifiers left then return
execute if score #or.attribute_modifier_amount OverlyRealistic.General.ArbitraryData matches 0 run \
    return fail

# -> Store attribute data
data modify storage overly_realistic:player_attributes temp_attribute_application.modifier_amount set from storage overly_realistic:player_attributes temp_attribute.modifiers[0].amount
data modify storage overly_realistic:player_attributes temp_attribute_application.modifier_operation set from storage overly_realistic:player_attributes temp_attribute.modifiers[0].operation
data modify storage overly_realistic:player_attributes temp_attribute_application.modifier_id set from storage overly_realistic:player_attributes temp_attribute.modifiers[0].id
data modify storage overly_realistic:player_attributes temp_attribute_application.attribute_id set from storage overly_realistic:player_attributes temp_attribute.id

# -> Apply modifier
function overly_realistic:general/downing/attribute_restoration/attribute_modifier_apply with storage overly_realistic:player_attributes temp_attribute_application

# -> Remove current modifier entry
data remove storage overly_realistic:player_attributes temp_attribute.modifiers[0]

# -> Loop
function overly_realistic:general/downing/attribute_restoration/attribute_modifier_get