execute if score ending_clock rmValue matches 1800 run time set 12000

execute if score ending_clock rmValue matches 1800 run execute as @a[tag=player] run gamemode spectator @a[tag=player]
#execute if score ending_clock rmValue matches 1800 as @a[tag=player] run spectate @e[tag=credits_viewpoint,limit=1] @s
execute if score ending_clock rmValue matches 1800..3049 run tp @a[tag=player] -46 261 -810 -90 1

#MUSIC!
execute if score ending_clock rmValue matches 1800 run execute as @a at @s run playsound tcoll.ending.credits master @a ~ ~ ~ 1 1

scoreboard players add ending_clock rmValue 1

# execute as @a[tag=player] run spectate @e[tag=credits_viewpoint,limit=1] @s
execute if score ending_clock rmValue matches 1800..3049 run execute as @a run gamemode spectator @a[tag=player]
# execute if score ending_clock rmValue matches 1800..3049 run tp @a[tag=player] -46 261 -810 -90 1

execute if score ending_clock rmValue matches 1801 run summon text_display -40 256 -810 {Tags:["credits_text","reset"],teleport_duration:3,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[4f,4f,4f]},billboard:"center",line_width:300,see_through:1b,text:[{bold: 0b, color: "white", text: "\uE000"}]}
execute if score ending_clock rmValue matches 1940 run summon text_display -40 256 -810 {Tags:["credits_text","reset"],teleport_duration:3,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[2f,2f,2f]},billboard:"center",line_width:300,see_through:1b,text:[{bold: 0b, color: "white", translate: "rm.credits_0_0", with:[{bold: 1b, color: "red", translate: "rm.credits_0_1"}]}]}
execute if score ending_clock rmValue matches 2010 run summon text_display -40 256 -810 {Tags:["credits_text","reset"],teleport_duration:3,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[2f,2f,2f]},billboard:"center",line_width:300,see_through:1b,text:[{bold: 0b, color: "white", translate: "rm.credits_1"}]}
execute if score ending_clock rmValue matches 2130 run summon text_display -40 256 -810 {Tags:["credits_text","reset"],teleport_duration:3,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[2f,2f,2f]},billboard:"center",line_width:300,see_through:1b,text:[{bold: 0b, color: "white", translate: "rm.credits_2"}]}
execute if score ending_clock rmValue matches 2170 run summon text_display -40 256 -810 {Tags:["credits_text","reset"],teleport_duration:3,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[2f,2f,2f]},billboard:"center",line_width:300,see_through:1b,text:[{bold: 0b, color: "white", translate: "rm.credits_3_0"}, {bold: 1b, color: "blue", translate: "rm.credits_3_1"}]}
execute if score ending_clock rmValue matches 2210 run summon text_display -40 256 -810 {Tags:["credits_text","reset"],teleport_duration:3,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[2f,2f,2f]},billboard:"center",line_width:300,see_through:1b,text:[{bold: 0b, color: "white", translate: "rm.credits_4_0"}, {bold: 1b, color: "blue", translate: "rm.credits_4_1"}]}
execute if score ending_clock rmValue matches 2310 run summon text_display -40 256 -810 {Tags:["credits_text","reset"],teleport_duration:3,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0f,0f],scale:[2f,2f,2f]},billboard:"center",line_width:300,see_through:1b,text:[{italic: 1b, color: "gray", translate: "rm.credits_5"}]}

execute if score ending_clock rmValue matches 2600 run tellraw @a [{translate: "rm.click_here", bold: 1b, color: "gold", click_event: {action: "open_url", url: "https://www.planetminecraft.com/project/veinbound-escape-together/"}}, {translate: "rm.credits_leave_a_review", color: "white"}, {text: "❤", color: "red", bold:0b}]

execute as @e[tag=credits_text] at @s run tp @s ~ ~0.025 ~

execute as @e[tag=credits_text] at @s positioned ~ 280 ~ if entity @s[distance=..3] run kill @s

execute if score ending_clock rmValue matches 2940 run title @a[tag=player] times 40t 40t 60t
execute if score ending_clock rmValue matches 2960 run title @a title [""]
execute if score ending_clock rmValue matches 2960 run title @a subtitle {text:"",font:"minecraft:fade"}
execute if score ending_clock rmValue matches 3050 run tp @a[tag=player] 7 113.5 66 90 -10
execute if score ending_clock rmValue matches 3050 run spawnpoint @a 7 114 66
execute if score ending_clock rmValue matches 3050 run execute as @a[tag=player] run gamemode adventure @s[tag=player]
execute if score ending_clock rmValue matches 3049 run title @a[tag=player] times 40t 40t 60t
execute if score ending_clock rmValue matches 3050 run function rm:reset
execute if score ending_clock rmValue matches 3050 run function rm:load
