########################################################################################################## *** PHASE 18 - DESERT *** #######################################################################################################



# 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_18 run tp @s 0 79 0



# Dungeon set #

execute as @a in simply_oneblock:phase_18 run execute if block 0 76 0 minecraft:air run place template simply_oneblock:phase_18_1 -1 70 -15
execute as @a in simply_oneblock:phase_18 run execute if block 50 81 1 minecraft:air run place template simply_oneblock:phase_18_2 30 70 -15

execute in simply_oneblock:phase_18 run execute if block 48 71 -10 minecraft:air unless block 48 72 -10 air run setblock 48 71 -10 minecraft:vault[facing=west]{config: {key_item: {components: {"minecraft:custom_name": "Treasure Room"}, count: 1, id: "minecraft:trial_key"}, loot_table: "simply_oneblock:trial_gate"}}
execute in simply_oneblock:phase_18 run execute if block 48 71 10 minecraft:air unless block 48 72 10 air run setblock 48 71 10 minecraft:vault[facing=west]{config: {key_item: {components: {"minecraft:custom_name": "Treasure Room"}, count: 1, id: "minecraft:trial_key"}, loot_table: "simply_oneblock:trial_gate"}}

execute in simply_oneblock:phase_18 run execute if block 48 71 -10 minecraft:vault{server_data:{total_ejections_needed: 3}} run fill 48 71 -10 48 72 -10 air
execute in simply_oneblock:phase_18 run execute if block 48 71 10 minecraft:vault{server_data:{total_ejections_needed: 3}} run fill 48 71 10 48 72 10 air



# Portal_out creation #

execute in simply_oneblock:phase_18 unless block 17 78 -7 minecraft:end_gateway if block 27 72 8 minecraft:trial_spawner[trial_spawner_state=cooldown] if block 27 72 -8 minecraft:trial_spawner[trial_spawner_state=cooldown] run tellraw @a {"text":"A portal has appeared !","italic":true,"color":"yellow"}

execute in simply_oneblock:phase_18 unless block 17 78 -7 minecraft:end_gateway if block 27 72 8 minecraft:trial_spawner[trial_spawner_state=cooldown] if block 27 72 -8 minecraft:trial_spawner[trial_spawner_state=cooldown] run playsound minecraft:entity.illusioner.cast_spell block @a 22 72 6

execute in simply_oneblock:phase_18 unless block 17 78 -7 minecraft:end_gateway if block 27 72 8 minecraft:trial_spawner[trial_spawner_state=cooldown] if block 27 72 -8 minecraft:trial_spawner[trial_spawner_state=cooldown] run execute in simply_oneblock:phase_18 run fill 17 78 -7 17 79 -7 minecraft:end_gateway



# Teleportation_back #

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


