particle minecraft:end_rod 0 190 209 2 2 2 0 2 normal
function parkour_pyramid:levels/level100/end/main
execute as @a[scores={level=100}] at @s if block ~ ~ ~ minecraft:end_gateway run tag @s add lvl100levitate
effect give @a[tag=lvl100levitate] levitation 1 1 true
execute as @a[tag=lvl100levitate] unless entity @s[x=0.5,y=180,z=199.5,dx=-1,dy=7.5,dz=-1] run effect clear @s levitation
execute as @a[tag=lvl100levitate] unless entity @s[x=0.5,y=180,z=199.5,dx=-1,dy=7.5,dz=-1] run tag @s remove lvl100levitate
execute at @a[tag=lvl100levitate] run fill 1 ~3 200 -1 ~3 198 air destroy
execute unless entity @a[tag=lvl100levitate] run fill -1 184 198 1 185 200 minecraft:stone
execute unless entity @a[tag=lvl100levitate] run fill 1 186 200 -1 186 198 minecraft:dirt
execute unless entity @a[tag=lvl100levitate] run fill 1 187 200 -1 187 198 minecraft:gravel


#DELAY
execute unless entity @a[x=1,y=180,z=200,dx=-2,dy=6,dz=-2] run tag @e[type=armor_stand,name=console,tag=up] add endPortalDelay
scoreboard players add @e[type=armor_stand,name=console,tag=endPortalDelay] endPortalTag 1

execute as @e[type=armor_stand,name=console,scores={endPortalTag=1..},tag=endPortalDelay] run tag @s remove up
execute as @e[type=armor_stand,name=console,scores={endPortalTag=20..},tag=endPortalDelay,tag=!wholePortal] run function parkour_pyramid:levels/level100/delayinitdown
execute as @e[type=armor_stand,name=console,scores={endPortalTag=70..},tag=endPortalDelay,tag=wholePortal] run function parkour_pyramid:levels/level100/delayinitdown

execute if entity @a[x=1,y=180,z=200,dx=-2,dy=6,dz=-2] run tag @e[type=armor_stand,name=console] add up
execute if entity @a[x=1,y=180,z=200,dx=-2,dy=6,dz=-2] run tag @e[type=armor_stand,name=console] remove down
execute if entity @a[x=1,y=180,z=200,dx=-2,dy=6,dz=-2] run tag @e[type=armor_stand,name=console] remove endPortalDelay
execute if entity @a[x=1,y=180,z=200,dx=-2,dy=6,dz=-2] run scoreboard players reset @e[type=armor_stand,name=console] endPortalTag

#UP
scoreboard players add @e[type=armor_stand,name=console,tag=up,scores={endPortalTimer=..60}] endPortalTimer 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 0 run setblock -2 180 199 minecraft:end_portal_frame[facing=west,eye=true]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 0 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] -2 180 199 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 0 run particle minecraft:dragon_breath -2 181 199 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 5 run setblock -2 180 198 minecraft:end_portal_frame[facing=west,eye=true]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 5 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] -2 180 198 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 5 run particle minecraft:dragon_breath -2 181 198 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 10 run setblock -1 180 197 minecraft:end_portal_frame[facing=north,eye=true]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 10 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] -1 180 197 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 10 run particle minecraft:dragon_breath -1 181 197 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 15 run setblock 0 180 197 minecraft:end_portal_frame[facing=north,eye=true]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 15 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 0 180 197 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 15 run particle minecraft:dragon_breath 0 181 197 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 20 run setblock 1 180 197 minecraft:end_portal_frame[facing=north,eye=true]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 20 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 1 180 197 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 20 run particle minecraft:dragon_breath 1 181 197 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 25 run setblock 2 180 198 minecraft:end_portal_frame[facing=east,eye=true]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 25 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 2 180 198 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 25 run particle minecraft:dragon_breath 2 181 198 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 30 run setblock 2 180 199 minecraft:end_portal_frame[facing=east,eye=true]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 30 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 2 180 199 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 30 run particle minecraft:dragon_breath 2 181 199 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 35 run setblock 2 180 200 minecraft:end_portal_frame[facing=east,eye=true]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 35 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 2 180 200 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 35 run particle minecraft:dragon_breath 2 181 200 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 40 run setblock 1 180 201 minecraft:end_portal_frame[eye=true,facing=south]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 40 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 1 180 201 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 40 run particle minecraft:dragon_breath 1 181 201 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 45 run setblock 0 180 201 minecraft:end_portal_frame[eye=true,facing=south]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 45 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 0 180 201 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 45 run particle minecraft:dragon_breath 0 181 201 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 50 run setblock -1 180 201 minecraft:end_portal_frame[eye=true,facing=south]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 50 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] -1 180 201 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 50 run particle minecraft:dragon_breath -1 181 201 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 55 run setblock -2 180 200 minecraft:end_portal_frame[eye=true,facing=west]
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 55 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] -2 180 200 1 1
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 55 run particle minecraft:dragon_breath -2 181 200 0.1 0.1 0.1 0.05 10 normal

execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 60 run fill -1 180 200 1 180 198 minecraft:end_gateway{Age:200L}
execute as @e[type=armor_stand,name=console,tag=up,scores={endPortalTimer=60}] run tag @s add wholePortal
execute if score @e[type=armor_stand,name=console,limit=1,tag=up] endPortalTimer matches 60 run playsound minecraft:block.end_portal.spawn block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 0 180 199 1 1

#DOWN
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 0 run setblock -2 180 199 minecraft:end_portal_frame[facing=east,eye=false]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 0 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] -2 180 199 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 5 run setblock -2 180 198 minecraft:end_portal_frame[facing=west,eye=false]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 5 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] -2 180 198 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 10 run setblock -1 180 197 minecraft:end_portal_frame[facing=north,eye=false]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 10 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] -1 180 197 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 15 run setblock 0 180 197 minecraft:end_portal_frame[facing=north,eye=false]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 15 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 0 180 197 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 20 run setblock 1 180 197 minecraft:end_portal_frame[facing=north,eye=false]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 20 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 1 180 197 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 25 run setblock 2 180 198 minecraft:end_portal_frame[facing=east,eye=false]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 25 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 2 180 198 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 30 run setblock 2 180 199 minecraft:end_portal_frame[facing=east,eye=false]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 30 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 2 180 199 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 35 run setblock 2 180 200 minecraft:end_portal_frame[facing=east,eye=false]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 35 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 2 180 200 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 40 run setblock 1 180 201 minecraft:end_portal_frame[eye=false,facing=south]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 40 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 1 180 201 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 45 run setblock 0 180 201 minecraft:end_portal_frame[eye=false,facing=south]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 45 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 0 180 201 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 50 run setblock -1 180 201 minecraft:end_portal_frame[eye=false,facing=south]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 50 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] -1 180 201 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 55 run setblock -2 180 200 minecraft:end_portal_frame[eye=false,facing=west]
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 55 run playsound minecraft:block.end_portal_frame.fill block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] -2 180 200 1 0.1

execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 60 run fill -1 180 200 1 180 198 minecraft:air
execute as @e[type=armor_stand,name=console,tag=down,scores={endPortalTimer=60}] run tag @s remove wholePortal
execute if score @e[type=armor_stand,name=console,limit=1,tag=down] endPortalTimer matches 60 run playsound minecraft:block.end_portal.spawn block @a[x=-15,y=165,z=188,dx=29,dy=17,dz=35] 0 180 199 1 0.6

scoreboard players remove @e[type=armor_stand,name=console,tag=down,scores={endPortalTimer=0..}] endPortalTimer 1


execute unless entity @a[x=2,y=177,z=201,dx=-4,dy=1,dz=-4] run data merge entity @e[type=armor_stand,tag=sp_end,limit=1] {CustomNameVisible:0b}
execute if entity @a[x=2,y=177,z=201,dx=-4,dy=1,dz=-4] run data merge entity @e[type=armor_stand,tag=sp_end,limit=1] {CustomNameVisible:1b}

kill @e[type=minecraft:falling_block,x=1,y=180,z=200,dx=-2,dy=4,dz=-2]
execute if block 0 177 199 minecraft:light_weighted_pressure_plate[power=1] positioned 0 177 199 as @p[distance=..1] run function parkour_pyramid:levels/level100/tp