########################################################################################################## *** PHASE 19 - THE END *** ######################################################################################################



# Portal_in creation #

execute unless block 0 65 0 minecraft:end_gateway run tellraw @a {"text":"To the End","italic":true,"color":"yellow"}
execute unless block 0 65 0 minecraft:end_gateway run playsound minecraft:entity.illusioner.cast_spell block @a 0 66 0
execute run fill 0 65 0 0 66 0 minecraft:end_gateway
execute run setblock 0 64 0 minecraft:bedrock



# Teleportation_in #

execute as @a at @s in minecraft:overworld if predicate simply_oneblock:portal run execute in simply_oneblock:phase_19 run tp @s 2 71 8



# Dungeon set #

execute as @a in simply_oneblock:phase_19 run execute if block 0 76 0 minecraft:air run place template simply_oneblock:phase_19_1 -1 70 -15

execute in simply_oneblock:phase_19 run execute if block 28 88 -9 minecraft:black_concrete run setblock 28 88 -9 minecraft:vault[facing=west]{config: {key_item: {components: {"minecraft:custom_name": "To the End"}, count: 1, id: "minecraft:trial_key"}, loot_table: "simply_oneblock:trial_gate"}}

execute in simply_oneblock:phase_19 run execute if block 28 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_19_bridge 30 79 -24
execute in simply_oneblock:phase_19 run execute if block 28 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_19_2 61 79 -24
execute in simply_oneblock:phase_19 run execute if block 28 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run playsound minecraft:entity.ender_dragon.ambient block @a 28 88 -9
execute in simply_oneblock:phase_19 run execute if block 28 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run fill 28 87 -10 28 90 -8 air



execute in simply_oneblock:phase_19 run execute if block 91 88 -9 minecraft:black_concrete run setblock 91 88 -9 minecraft:vault[facing=west]{config: {key_item: {components: {"minecraft:custom_name": "To the End"}, count: 1, id: "minecraft:trial_key"}, loot_table: "simply_oneblock:trial_gate"}}

execute in simply_oneblock:phase_19 run execute if block 91 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_19_bridge 92 79 -24
execute in simply_oneblock:phase_19 run execute if block 91 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_19_3 123 79 -24
execute in simply_oneblock:phase_19 run execute if block 91 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run playsound minecraft:entity.ender_dragon.ambient block @a 91 88 -9
execute in simply_oneblock:phase_19 run execute if block 91 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run fill 91 87 -10 91 89 -8 air



execute in simply_oneblock:phase_19 run execute if block 153 88 -9 minecraft:black_concrete run setblock 153 88 -9 minecraft:vault[facing=west]{config: {key_item: {components: {"minecraft:custom_name": "To the End"}, count: 1, id: "minecraft:trial_key"}, loot_table: "simply_oneblock:trial_gate"}}

execute in simply_oneblock:phase_19 run execute if block 153 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_19_bridge 154 79 -24
execute in simply_oneblock:phase_19 run execute if block 153 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_19_4 185 79 -24
execute in simply_oneblock:phase_19 run execute if block 153 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run playsound minecraft:entity.ender_dragon.ambient block @a 153 88 -9
execute in simply_oneblock:phase_19 run execute if block 153 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run fill 153 87 -10 153 89 -8 air



execute in simply_oneblock:phase_19 run execute if block 215 88 -9 minecraft:black_concrete run setblock 215 88 -9 minecraft:vault[facing=west]{config: {key_item: {components: {"minecraft:custom_name": "To the End"}, count: 1, id: "minecraft:trial_key"}, loot_table: "simply_oneblock:trial_gate"}}

execute in simply_oneblock:phase_19 run execute if block 215 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_19_bridge 216 79 -24
execute in simply_oneblock:phase_19 run execute if block 215 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_19_5 247 79 -24
execute in simply_oneblock:phase_19 run execute if block 215 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run playsound minecraft:entity.ender_dragon.ambient block @a 215 88 -9
execute in simply_oneblock:phase_19 run execute if block 215 88 -9 minecraft:vault{server_data:{total_ejections_needed: 3}} run fill 215 87 -10 215 89 -8 air



# Teleportation_out #

execute as @a at @s in minecraft:the_end if predicate simply_oneblock:end_offset if score fake_player ib_minedcount matches 8500 run execute in minecraft:overworld run fill 0 64 0 0 66 0 minecraft:air


