execute as @s at @s run function koncept:level/54.2

scoreboard players add @s[scores={timer_an=1..}] timer_an 1
execute unless entity @a[tag=55_end,scores={timer_an=2..}] run execute positioned 32 18 5 if entity @s[distance=..1,tag=!55_end] run scoreboard players set @s timer_an 1
execute unless entity @a[tag=55_end,scores={timer_an=2..}] run execute positioned 32 18 5 if entity @s[distance=..1,tag=!55_end] run tag @s add 55_end

execute if score @s timer_an matches 1 run summon minecraft:armor_stand 32 18 5 {Invisible:true,Invulnerable:true,Rotation:[90f,80f],Tags:["end_55"]}
gamemode spectator @s[scores={timer_an=1..52}]
execute if score @s timer_an matches 1 run scoreboard players set @a end_anim 0
execute if score @s timer_an matches 1 run kill @e[type=minecraft:text_display,tag=text_author_end,limit=1]
execute if score @s timer_an matches 1 run scoreboard players set end end_anim 0
execute if score @s timer_an matches 1 run kill @e[type=minecraft:interaction,tag=open_ur_end,limit=1]
execute if score @s timer_an matches 1 run execute as @e[tag=author_end] at @s run function animated_java:author_end/remove/all
execute if score @s timer_an matches 1..55 run spectate @e[type=minecraft:armor_stand,tag=end_55,limit=1,sort=nearest,distance=..2] @s
execute if score @s timer_an matches 1 run execute as @e[tag=end_55,type=minecraft:armor_stand,limit=1,sort=nearest,distance=..1] at @s run data merge entity @s {Motion:[0.0,1.0,0.0]}
execute if score @s timer_an matches 9 run execute as @e[tag=end_55,type=minecraft:armor_stand,limit=1,sort=nearest,distance=..1] at @s run data merge entity @s {Motion:[0.0,1.0,0.0]}
execute if score @s timer_an matches 18 run execute as @e[tag=end_55,type=minecraft:armor_stand,limit=1,sort=nearest,distance=..1] at @s run data merge entity @s {Motion:[0.0,1.0,0.0]}
execute if score @s timer_an matches 22 run execute as @e[tag=end_55,type=minecraft:armor_stand,limit=1,sort=nearest,distance=..1] at @s run data merge entity @s {Motion:[0.0,0.1,0.0]}
execute if score @s timer_an matches 24 run execute as @e[tag=end_55,type=minecraft:armor_stand,limit=1,sort=nearest,distance=..1] at @s run data merge entity @s {Motion:[-0.5,0.5,0.0]}

execute if score @s timer_an matches 1 if score end end_anim matches 0 run scoreboard players add @s end_anim 50

execute if score @s timer_an matches 1 if score @s end_anim matches ..51 if score end end_anim matches 0 run execute positioned 23 25 5 run function animated_java:author_end/summon {args:{}}
execute if score @s timer_an matches 1 if score @s end_anim matches ..51 if score end end_anim matches 0 run execute as @e[type=item_display,tag=aj.author_end.root] at @s run tp @s ~ ~ ~ -180 0
execute if score @s timer_an matches 2 if score @s end_anim matches ..51 if score end end_anim matches 0 run execute as @e[tag=author_end] at @s run function animated_java:author_end/animations/start2/play
execute if score @s timer_an matches 48 if score @s end_anim matches ..51 if score end end_anim matches 0 run execute as @e[tag=author_end] at @s run function animated_java:author_end/animations/start/play
execute if score @s timer_an matches 97 if score @s end_anim matches ..51 if score end end_anim matches 0 run execute as @e[tag=author_end] at @s run function animated_java:author_end/animations/author_end/play

execute if score @s timer_an matches 2 if score @s end_anim matches 1 run scoreboard players set @s end_anim 2

execute if score @s timer_an matches 97 if score end end_anim matches 0 run execute as @e[tag=author_end] at @s run scoreboard players set end end_anim 1


execute if score @s timer_an matches 53 run kill @e[type=minecraft:armor_stand,tag=end_55,distance=..1]
execute if score @s timer_an matches 3 run summon firework_rocket 32 22 5 {LifeTime:12,FireworksItem:{id:firework_rocket,Count:1,tag:{Fireworks:{Explosions:[{Type:0,Colors:[I;11743532,3887386,2437522,2651799,15435844],FadeColors:[I;4312372,14602026,6719955,12801229]}],Flight:-1}}}}
execute if score @s timer_an matches 15 run playsound minecraft:block.lava.pop master @a 32 22 5 111
execute if score @s timer_an matches 18 run particle minecraft:large_smoke 32 22 5 0.1 0.5 0.1 0.1 20
execute if score @s timer_an matches 1 run playsound minecraft:custom.sprout_respawn block @s 32 22 5 1111 1
execute if score @s timer_an matches 12 run particle minecraft:lava 32 22 5 0.1 0.5 0.1 0.1 20

gamemode adventure @s[scores={timer_an=53}]
tag @s[scores={timer_an=100}] remove 55_end
execute if score @s timer_an matches 100 run scoreboard players reset @s timer_an

execute if score @s timer_an matches 1 if score @s end_anim matches ..51 if score end end_anim matches 0 run summon text_display 23 27.5 5 {shadow:1b,Rotation:[-90F,0F],Tags:["text_start","text_author_end"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[2f,2f,2f]},text:{"color":"#FFCC64","text":"Author"},background:0}

execute if score @s timer_an matches 1 if score @s end_anim matches ..51 if score end end_anim matches 0 run summon interaction 23 25 5 {width:2.5f,height:2.5f,Tags:["open_ur_end","koncept_interaction"],response:0b,interaction:{player:[I;0,0,0,0],timestamp:0L},attack:{player:[I;0,0,0,0],timestamp:0L}}


title @s[scores={timer_an=53}] title {"text":"T","color":"dark_aqua"}
title @s[scores={timer_an=53}] times 0 20 20
title @s[scores={timer_an=59}] title {"text":"Th","color":"dark_aqua"}
title @s[scores={timer_an=65}] title {"text":"The","color":"dark_aqua"}
title @s[scores={timer_an=71}] title {"text":"The ","color":"dark_aqua"}
title @s[scores={timer_an=77}] title {"text":"The e","color":"dark_aqua"}
title @s[scores={timer_an=83}] title {"text":"The en","color":"dark_aqua"}
title @s[scores={timer_an=89}] title {"text":"The end","color":"dark_aqua"}

execute as @s[scores={timer_an=99}] at @s run function koncept:spawn/time 

execute if score @s timer_an matches 2.. run function koncept:level/55.1