######Finds which array element of attribute modifiers contains the generic.max_health tag
tag @s add a
tag @s add b
tag @s add c
tag @s add d
tag @s add e
tag @s add f
tag @s add g
data modify entity @s[tag=!FoundHPTag] Tags[0] set from entity @s[tag=!FoundHPTag] Item.tag.AttributeModifiers[0].Name
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag0
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag
data modify entity @s[tag=!FoundHPTag] Tags[0] set from entity @s[tag=!FoundHPTag] Item.tag.AttributeModifiers[1].Name
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag1
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag
data modify entity @s[tag=!FoundHPTag] Tags[0] set from entity @s[tag=!FoundHPTag] Item.tag.AttributeModifiers[2].Name
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag2
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag
data modify entity @s[tag=!FoundHPTag] Tags[0] set from entity @s[tag=!FoundHPTag] Item.tag.AttributeModifiers[3].Name
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag3
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag
data modify entity @s[tag=!FoundHPTag] Tags[0] set from entity @s[tag=!FoundHPTag] Item.tag.AttributeModifiers[4].Name
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag4
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag
data modify entity @s[tag=!FoundHPTag] Tags[0] set from entity @s[tag=!FoundHPTag] Item.tag.AttributeModifiers[5].Name
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag5
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag
data modify entity @s[tag=!FoundHPTag] Tags[0] set from entity @s[tag=!FoundHPTag] Item.tag.AttributeModifiers[6].Name
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag6
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag
data modify entity @s[tag=!FoundHPTag] Tags[0] set from entity @s[tag=!FoundHPTag] Item.tag.AttributeModifiers[7].Name
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag7
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag
data modify entity @s[tag=!FoundHPTag] Tags[0] set from entity @s[tag=!FoundHPTag] Item.tag.AttributeModifiers[8].Name
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag8
tag @s[tag=!FoundHPTag,tag=generic.max_health] add FoundHPTag

data modify entity @s[tag=!FoundHPTag] Item.tag.AttributeModifiers append value {AttributeName:"generic.max_health",Name:"generic.max_health",Amount:0,Operation:0,Slot:"mainhand",UUID:[I;6969,6969,6969,1184]}