####################################################################################################### *** PHASE 7 - THE NETHER *** #######################################################################################################



# 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_7 run tp @s 5 76 0



# Dungeon set #

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



execute in simply_oneblock:phase_7 run execute if block 14 79 -14 minecraft:air unless block 14 77 -15 crimson_hyphae run setblock 14 79 -14 minecraft:vault[facing=south]{config: {key_item: {components: {"minecraft:custom_name": "Bastion Key"}, count: 1, id: "minecraft:trial_key"}, loot_table: "simply_oneblock:trial_gate"}}

execute in simply_oneblock:phase_7 run execute if block 0 79 0 minecraft:air unless block -1 77 0 soul_soil run setblock 0 79 0 minecraft:vault[facing=east]{config: {key_item: {components: {"minecraft:custom_name": "Ossuary Key"}, count: 1, id: "minecraft:trial_key"}, loot_table: "simply_oneblock:trial_gate"}}

execute in simply_oneblock:phase_7 run execute if block 14 79 14 minecraft:air unless block 14 77 15 nether_bricks run setblock 14 79 14 minecraft:vault[facing=north]{config: {key_item: {components: {"minecraft:custom_name": "Fortress Key"}, count: 1, id: "minecraft:trial_key"}, loot_table: "simply_oneblock:trial_gate"}}

execute in simply_oneblock:phase_7 run execute if block 28 79 0 minecraft:air run setblock 28 79 0 minecraft:vault[facing=west,ominous=true]{config: {key_item: {components: {"minecraft:custom_name": "Wither Arena"}, count: 1, id: "minecraft:ominous_trial_key"}, loot_table: "simply_oneblock:trial_gate"}}



execute in simply_oneblock:phase_7 run execute if block 14 79 -14 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_7_piglin -1 70 -45
execute in simply_oneblock:phase_7 run execute if block 14 79 -14 minecraft:vault{server_data:{total_ejections_needed: 3}} run playsound minecraft:entity.lightning_bolt.thunder block @a 14 79 -14
execute in simply_oneblock:phase_7 run execute if block 14 79 -14 minecraft:vault{server_data:{total_ejections_needed: 3}} run fill 13 78 -14 15 82 -15 air

execute in simply_oneblock:phase_7 run execute if block 0 79 0 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_7_soul -31 70 -15
execute in simply_oneblock:phase_7 run execute if block 0 79 0 minecraft:vault{server_data:{total_ejections_needed: 3}} run playsound minecraft:entity.lightning_bolt.thunder block @a 0 79 0
execute in simply_oneblock:phase_7 run execute if block 0 79 0 minecraft:vault{server_data:{total_ejections_needed: 3}} run fill 0 78 -1 0 82 1 air

execute in simply_oneblock:phase_7 run execute if block 14 79 14 minecraft:vault{server_data:{total_ejections_needed: 3}} run place template simply_oneblock:phase_7_blaze -1 70 15
execute in simply_oneblock:phase_7 run execute if block 14 79 14 minecraft:vault{server_data:{total_ejections_needed: 3}} run playsound minecraft:entity.lightning_bolt.thunder block @a 17 79 10
execute in simply_oneblock:phase_7 run execute if block 14 79 14 minecraft:vault{server_data:{total_ejections_needed: 3}} run fill 13 78 14 15 82 15 air



# Portal_out creation #

execute in simply_oneblock:phase_7 unless block 15 76 -2 minecraft:end_gateway if block 14 79 33 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_7 unless block 15 76 -2 minecraft:end_gateway if block 14 79 33 minecraft:trial_spawner[trial_spawner_state=ejecting_reward] run playsound minecraft:entity.illusioner.cast_spell block @a 15 76 -2

execute in simply_oneblock:phase_7 unless block 15 76 -2 minecraft:end_gateway if block 14 79 33 minecraft:trial_spawner[trial_spawner_state=ejecting_reward] run execute in simply_oneblock:phase_7 run fill 13 76 2 15 76 2 minecraft:end_gateway
execute in simply_oneblock:phase_7 unless block 15 76 -2 minecraft:end_gateway if block 14 79 33 minecraft:trial_spawner[trial_spawner_state=ejecting_reward] run execute in simply_oneblock:phase_7 run fill 12 76 1 16 76 -1 minecraft:end_gateway
execute in simply_oneblock:phase_7 unless block 15 76 -2 minecraft:end_gateway if block 14 79 33 minecraft:trial_spawner[trial_spawner_state=ejecting_reward] run execute in simply_oneblock:phase_7 run fill 13 76 -2 15 76 -2 minecraft:end_gateway



# Teleportation_back #

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