execute as @e[name=CadeyrnFight] store result score @s PosX run data get entity @s Pos[0] 1
execute as @e[name=CadeyrnFight] run scoreboard players set @s PosY 138
execute as @e[name=CadeyrnFight] store result score @s PosZ run data get entity @s Pos[2] 1
execute as @e[name=CadeyrnFight] run scoreboard players add @s PosX 21
execute as @e[name=CadeyrnFight] run scoreboard players remove @s PosZ 18
execute at @e[name=CadeyrnFight] run setblock ~-1 ~ ~ minecraft:end_gateway{ExactTeleport:1b}
execute as @e[name=CadeyrnFight] run execute at @s run execute store result block ~-1 ~ ~ ExitPortal.X int 1 run scoreboard players get @s PosX
execute as @e[name=CadeyrnFight] run execute at @s run execute store result block ~-1 ~ ~ ExitPortal.Y int 1 run scoreboard players get @s PosY
execute as @e[name=CadeyrnFight] run execute at @s run execute store result block ~-1 ~ ~ ExitPortal.Z int 1 run scoreboard players get @s PosZ
execute at @e[name=CadeyrnFight] run clone ~-1 ~ ~ ~-1 ~ ~ ~-1 ~1 ~
execute at @e[name=CadeyrnFight] run clone ~-1 ~ ~ ~-1 ~ ~ ~-1 ~2 ~
execute at @e[name=CadeyrnFight] run clone ~-1 ~2 ~ ~-1 ~ ~ ~-1 ~ ~1
execute at @e[name=CadeyrnFight] run clone ~-1 ~2 ~ ~-1 ~ ~ ~-1 ~ ~-1
execute at @e[name=CadeyrnFight] run clone ~-1 ~2 ~ ~-1 ~ ~ ~-1 ~ ~2
execute at @e[name=CadeyrnFight] run clone ~-1 ~2 ~ ~-1 ~ ~ ~-1 ~ ~-2
execute at @e[name=CadeyrnFight] run tp @a[tag=CadeyrnFightStart,distance=..100] ~ 130 ~
execute at @e[name=CadeyrnFight] run fill ~-15 1 ~-15 ~16 17 ~15 air replace barrier
execute as @e[name=CadeyrnFight] run execute at @s run tp @s ~ 131 ~
gamemode survival @a[tag=CadeyrnFightTag]
execute at @e[name="Cadeyrn the Wretched"] run tp @e[distance=..3] @e[name=CadeyrnFight,limit=1]
execute at @e[name="Cadeyrn the Wretched"] run tag @e[distance=..3,type=skeleton_horse] add CadeyrnHorse
execute at @e[name="Cadeyrn the Wretched"] run tag @e[distance=..3,type=skeleton_horse] add CadeyrnTP
execute as @e[name="Cadeyrn the Wretched"] run tag @s add RealCadeyrn
execute as @e[name="Cadeyrn the Wretched"] run tag @s add CadeyrnTP
execute at @e[name="Cadeyrn the Wretched"] run tp @e[distance=..3,tag=CadeyrnTP] ~ 138 ~
execute as @e[tag=CadeyrnTP] run data merge entity @s {NoGravity:1}
#execute at @e[name=CadeyrnFight] run fill ~-30 128 ~-30 ~30 128 ~30 minecraft:lime_concrete_powder
#execute at @e[name=HomeTP,tag=!Coords] run execute store result block ~ ~-2 ~ ExitPortal.X int 1 run scoreboard players get @e[name=DayQ,limit=1] PosX
#execute at @e[name=CadeyrnFight] run tp @p[tag=CadeyrnFightTag] ~20 137 ~-17
bossbar add cadeyrn {"text":"Cadeyrn the Wretched fallen knight of Vortigryn al Mahgin The Blood Forsaken","color":"#FF9D0A"}
bossbar set minecraft:cadeyrn color red
bossbar set minecraft:cadeyrn players @a[tag=CadeyrnFightTag]
scoreboard players set @e[tag=CadeyrnTP,type=stray] CadeyrnBaseHP 1500
scoreboard players set @e[tag=CadeyrnTP,type=stray] CadeyrnBossBarHP 1500
scoreboard players set @e[tag=CadeyrnTP,type=stray] CadeyrnHalfHP 825
scoreboard players set @e[tag=CadeyrnTP,type=stray] CadeyrnFinStHP 150
#scoreboard players add @e[type=armor_stand,name=CadeyrnFight] CadeyrnPlayers 1
execute as @e[tag=CadeyrnTP] run data merge entity @s {Invulnerable:0,Health:900f,Attributes:[{Name:generic.follow_range,Base:60},{Name:generic.max_health,Base:900}]}
execute as @e[tag=CadeyrnTP,type=stray] run function zzzzdonotuse:cadeyrn/increasebosshp
execute as @e[tag=CadeyrnTP,type=stray] run scoreboard players set @s CadeyrnMaxHP 900
#bossbar set minecraft:cadeyrn max 800
#bossbar set minecraft:cadeyrn value 800
#execute as @e[tag=CadeyrnTP] run data merge entity @s {Health:900f,Attributes:[{Name:generic.max_health,Base:1024}]}
#TURN ON TIMER
tag @e[tag=CadeyrnTP] add FightStart
execute in minecraft:overworld run data merge block 999997 126 999969 {auto:1b}
execute as @e[tag=CadeyrnTP] run execute at @s run tp @s @e[type=armor_stand,name=CadeyrnFight,limit=1]
execute as @e[tag=CadeyrnTP] run execute at @s run tp @s ~ 140 ~4
tp @e[type=slime,tag=ShopSlime] ~ ~-500 ~
scoreboard players set @e[type=stray,tag=CadeyrnTP] CadeyrnTimer -6
effect clear @e[tag=CadeyrnTP] levitation
execute as @a[tag=CadeyrnFightTag,tag=!MusicTagKyu] run execute at @s run playsound minecraft:music_disc.piggyidklol record @s ~ ~5000 ~ 0.20 1 0.20
tag @a[tag=CadeyrnFightTag] add MusicTagKyu
effect give @e[tag=CadeyrnTP] fire_resistance 120000 0