team join color_51_1 @e[type=minecraft:magma_cube,tag=51_block_g]
team join color_51_2 @e[type=minecraft:magma_cube,tag=51_block_g_1]
team join color_51_3 @e[type=minecraft:magma_cube,tag=51_block_g_2]

execute unless entity @e[tag=51_block_g] run function koncept:level/51.1
execute unless entity @e[tag=51_block_g_1] run function koncept:level/51.2
execute unless entity @e[tag=51_block_g_2] run function koncept:level/51.3

execute as @a[scores={checkpoint=51}] at @s run function koncept:level/53.1

execute as @a[scores={checkpoint=51}] at @s run execute as @s[y=-1,dy=0] at @s run function koncept:return_stage with storage stage:checkpoint

execute as @a[scores={checkpoint=51,checkpoint_between_51=0}] at @s positioned 18 13 -14 if entity @s[distance=..2] run tag @s add return_stage_checkpoint_message
execute as @a[scores={checkpoint=51,checkpoint_between_51=0}] at @s positioned 18 13 -14 if entity @s[distance=..2] run spawnpoint @s 18 13 -14 1186.76
execute as @a[scores={checkpoint=51,checkpoint_between_51=0}] at @s positioned 18 13 -14 if entity @s[distance=..2] run scoreboard players set @s checkpoint_between_51 1

execute as @a[scores={checkpoint=51,checkpoint_between_51=1}] at @s positioned 13 20 -32 if entity @s[distance=..2] run tag @s add return_stage_checkpoint_message
execute as @a[scores={checkpoint=51,checkpoint_between_51=1}] at @s positioned 13 20 -32 if entity @s[distance=..2] run spawnpoint @s 13 21 -35 267.52
execute as @a[scores={checkpoint=51,checkpoint_between_51=1}] at @s positioned 13 20 -32 if entity @s[distance=..2] run scoreboard players set @s checkpoint_between_51 2


execute as @a[scores={checkpoint=51}] at @s positioned 23 9 3 if entity @a[distance=..2] run execute as @e[type=minecraft:magma_cube,tag=51_block_g] at @s run data merge entity @s {Glowing:1b}

execute as @a[scores={checkpoint=51}] at @s positioned 23 9 3 unless entity @a[distance=..2] run execute as @e[type=minecraft:magma_cube,tag=51_block_g] at @s run data merge entity @s {Glowing:0b}



#5151511508 5151511509

execute positioned 18 13 -14 if entity @a[distance=..3] unless score 5151511508 timer_an matches 2 run scoreboard players set 5151511508 timer_an 1
execute if score 5151511508 timer_an matches 1 run scoreboard players add 5151511509 timer_an 1

execute if score 5151511509 timer_an matches 5 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_2_1] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511509 timer_an matches 5 run execute positioned 15 14 -21 run playsound minecraft:entity.item.pickup block @a[distance=..12] 15 14 -21 1111 1

execute if score 5151511509 timer_an matches 20 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_2_2] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511509 timer_an matches 20 run execute positioned 15 14 -21 run playsound minecraft:entity.item.pickup block @a[distance=..12] 15 14 -21 1111 1

execute if score 5151511509 timer_an matches 40 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_2_3] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511509 timer_an matches 40 run execute positioned 15 14 -21 run playsound minecraft:entity.item.pickup block @a[distance=..12] 15 14 -21 1111 1

execute if score 5151511509 timer_an matches 60 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_2_4] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511509 timer_an matches 60 run execute positioned 15 14 -21 run playsound minecraft:entity.item.pickup block @a[distance=..12] 15 14 -21 1111 1

execute if score 5151511509 timer_an matches 80 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_2_5] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511509 timer_an matches 80 run execute positioned 15 14 -21 run playsound minecraft:entity.item.pickup block @a[distance=..12] 15 14 -21 1111 1

execute if score 5151511509 timer_an matches 100 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_2_6] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511509 timer_an matches 100 run execute positioned 15 14 -21 run playsound minecraft:entity.item.pickup block @a[distance=..12] 15 14 -21 1111 1

execute if score 5151511509 timer_an matches 120 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_2_7] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511509 timer_an matches 120 run execute positioned 15 14 -21 run playsound minecraft:entity.item.pickup block @a[distance=..12] 15 14 -21 1111 1

execute if score 5151511509 timer_an matches 140 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_2_8] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511509 timer_an matches 140 run execute positioned 15 14 -21 run playsound minecraft:entity.item.pickup block @a[distance=..12] 15 14 -21 1111 1

execute if score 5151511509 timer_an matches 160 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_2_9] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511509 timer_an matches 160 run execute positioned 15 14 -21 run playsound minecraft:entity.item.pickup block @a[distance=..12] 15 14 -21 1111 1

execute if score 5151511509 timer_an matches 220 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_2] at @s run data merge entity @s {Glowing:0b}

execute if score 5151511509 timer_an matches 220 run scoreboard players reset 5151511508 timer_an
execute if score 5151511509 timer_an matches 220 run scoreboard players reset 5151511509 timer_an




#5151511501 5151511502

execute positioned 20 13 -2 if entity @a[distance=..3] unless score 5151511501 timer_an matches 2 run scoreboard players set 5151511501 timer_an 1
execute if score 5151511501 timer_an matches 1 run scoreboard players add 5151511502 timer_an 1

execute if score 5151511502 timer_an matches 5 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_1_1] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511502 timer_an matches 5 run execute positioned 18 14 1 run playsound minecraft:entity.item.pickup block @a[distance=..12] 18 14 1 1111 1

execute if score 5151511502 timer_an matches 20 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_1_2] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511502 timer_an matches 20 run execute positioned 18 14 1 run playsound minecraft:entity.item.pickup block @a[distance=..12] 18 14 1 1111 1

execute if score 5151511502 timer_an matches 40 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_1_3] at @s run data merge entity @s {Glowing:1b}
execute if score 5151511502 timer_an matches 40 run execute positioned 18 14 1 run playsound minecraft:entity.item.pickup block @a[distance=..12] 18 14 1 1111 1

execute if score 5151511502 timer_an matches 90 run execute as @e[type=minecraft:magma_cube,tag=51_block_g_1] at @s run data merge entity @s {Glowing:0b}

execute if score 5151511502 timer_an matches 90 run scoreboard players reset 5151511501 timer_an
execute if score 5151511502 timer_an matches 90 run scoreboard players reset 5151511502 timer_an


