execute store result bossbar undead_king max run attribute @e[tag=undead_king,limit=1] max_health get
execute store result bossbar undead_king value run data get entity @e[tag=undead_king,limit=1] Health
execute if entity @e[tag=undead_king] run bossbar set undead_king visible true
execute at @e[tag=undead_king] run bossbar set undead_king players @a[distance=..50]
execute as @e[tag=undead_king] if score @s time < @e[tag=undead_king,limit=1,sort=arbitrary] time run function survivalplus:bossbar/multibossfix/undead_king

#execute if score hardmode hardmode matches 1 at @e[tag=undead_king] run effect give @e[distance=..10,type=wither_skeleton,tag=!boss] resistance 1 0
#execute if score hardmode hardmode matches 1 at @e[tag=undead_king] run particle smoke ~ ~ ~ 8 8 8 .005 5 normal