is there a better way to write this function? i was thinking item modifiers but i dont really know how they work
[30m##[34m Add Tag
[30m# Util function for adding an entity tag to a spawn egg
##[34m Args
[30m# tag : string
[35mexecute [34munless block [32m~ ~ ~ [36m#air [34mrun [35mreturn [34mfail
[35msetblock [32m~ ~ ~ [33mminecraft:barrel
[35mitem [34mreplace block [32m~ ~ ~ [0mcontainer.0 [34mfrom entity [36m@s [0mweapon.mainhand
[37m$[35mdata [34mmodify block [32m~ ~ ~ [0mItems[33m[[32m0[33m].components."minecraft:entity_data"[36m.Tags [34mappend value $[33m([0mtag[33m)
[35mitem [34mreplace entity [36m@s [0mweapon.mainhand [34mfrom block [32m~ ~ ~ [0mcontainer.0
[35msetblock [32m~ ~ ~ [0mair