################################################################################################ *** PHASE 5 - SNOWY PLAINS & MOUNTAINS *** ################################################################################################



# Portal_in creation #

execute unless block 0 65 0 minecraft:end_gateway run tellraw @a {"text":"A portal has appeared !","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_5 run tp @s 0 78 0



# Dungeon set #

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

execute in simply_oneblock:phase_5 run execute if block 18 78 0 minecraft:air if block 30 76 0 air run setblock 18 78 0 minecraft:vault[facing=west]{config: {key_item: {components: {"minecraft:custom_name": "Stray Dungeon Key"}, count: 1, id: "minecraft:trial_key"}, loot_table: "simply_oneblock:trial_gate"}}

execute in simply_oneblock:phase_5 run execute if block 18 78 0 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_5_stray 30 70 -15
execute in simply_oneblock:phase_5 run execute if block 18 78 0 minecraft:vault{server_data:{total_ejections_needed: 3}} run playsound minecraft:entity.lightning_bolt.thunder block @a 18 78 0
execute in simply_oneblock:phase_5 run execute if block 18 78 0 minecraft:vault{server_data:{total_ejections_needed: 3}} run fill 18 77 -2 19 81 3 air



# Portal_out creation #

execute in simply_oneblock:phase_5 unless block 7 77 9 minecraft:end_gateway if block 32 78 0 minecraft:trial_spawner[trial_spawner_state=ejecting_reward] run tellraw @a {"text":"A portal has appeared !","italic":true,"color":"yellow"}

execute in simply_oneblock:phase_5 unless block 7 77 9 minecraft:end_gateway if block 32 78 0 minecraft:trial_spawner[trial_spawner_state=ejecting_reward] run playsound minecraft:entity.illusioner.cast_spell block @a 13 74 -1

execute in simply_oneblock:phase_5 unless block 7 77 9 minecraft:end_gateway if block 32 78 0 minecraft:trial_spawner[trial_spawner_state=ejecting_reward] run execute in simply_oneblock:phase_5 run fill 7 77 9 7 78 9 minecraft:end_gateway



# Teleportation_back #

execute as @a at @s in simply_oneblock:phase_5 if predicate simply_oneblock:portal if score fake_player ib_minedcount matches 1500 run execute in minecraft:overworld run fill 0 64 0 0 66 0 minecraft:air