#
# 		Data pack by IJAMinecraft
# 		@ ijaminecraft.com
# 		@ youtube.com/user/IJAMinecraft
#

scoreboard players set @e[tag=ija-a4-mined] ija-a4-cooldown 5

execute as @s[scores={ija-a4-counter=1..47,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 run function ija-one-block:generated/phase/00
scoreboard players set @s[scores={ija-a4-counter=48,ija-a4-cooldown=1}] ija-a4-upgrade 200
execute as @s[scores={ija-a4-counter=48,ija-a4-cooldown=1}] run function ija-one-block:generated/phase/spawn-upgrade-entities
execute as @s[scores={ija-a4-counter=48,ija-a4-cooldown=1}] run setblock ~ ~ ~ minecraft:bedrock

execute as @s[scores={ija-a4-counter=49..282,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 run function ija-one-block:generated/phase/01
scoreboard players set @s[scores={ija-a4-counter=283,ija-a4-cooldown=1}] ija-a4-upgrade 400
execute as @s[scores={ija-a4-counter=283,ija-a4-cooldown=1}] run function ija-one-block:generated/phase/spawn-upgrade-entities
execute as @s[scores={ija-a4-counter=283,ija-a4-cooldown=1}] run setblock ~ ~ ~ minecraft:bedrock

execute as @s[scores={ija-a4-counter=284..680,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 run function ija-one-block:generated/phase/02
scoreboard players set @s[scores={ija-a4-counter=681,ija-a4-cooldown=1}] ija-a4-upgrade 600
execute as @s[scores={ija-a4-counter=681,ija-a4-cooldown=1}] run function ija-one-block:generated/phase/spawn-upgrade-entities
execute as @s[scores={ija-a4-counter=681,ija-a4-cooldown=1}] run setblock ~ ~ ~ minecraft:bedrock

execute as @s[scores={ija-a4-counter=682..1154,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 run function ija-one-block:generated/phase/03
scoreboard players set @s[scores={ija-a4-counter=1155,ija-a4-cooldown=1}] ija-a4-upgrade 800
execute as @s[scores={ija-a4-counter=1155,ija-a4-cooldown=1}] run function ija-one-block:generated/phase/spawn-upgrade-entities
execute as @s[scores={ija-a4-counter=1155,ija-a4-cooldown=1}] run setblock ~ ~ ~ minecraft:bedrock

execute as @s[scores={ija-a4-counter=1156..1725,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 run function ija-one-block:generated/phase/04
scoreboard players set @s[scores={ija-a4-counter=1726,ija-a4-cooldown=1}] ija-a4-upgrade 1000
execute as @s[scores={ija-a4-counter=1726,ija-a4-cooldown=1}] run function ija-one-block:generated/phase/spawn-upgrade-entities
execute as @s[scores={ija-a4-counter=1726,ija-a4-cooldown=1}] run setblock ~ ~ ~ minecraft:bedrock

execute as @s[scores={ija-a4-counter=1727..2364,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 run function ija-one-block:generated/phase/05
scoreboard players set @s[scores={ija-a4-counter=2365,ija-a4-cooldown=1}] ija-a4-upgrade 1200
execute as @s[scores={ija-a4-counter=2365,ija-a4-cooldown=1}] run function ija-one-block:generated/phase/spawn-upgrade-entities
execute as @s[scores={ija-a4-counter=2365,ija-a4-cooldown=1}] run setblock ~ ~ ~ minecraft:bedrock

execute as @s[scores={ija-a4-counter=2366..3088,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 run function ija-one-block:generated/phase/06
scoreboard players set @s[scores={ija-a4-counter=3089,ija-a4-cooldown=1}] ija-a4-upgrade 1400
execute as @s[scores={ija-a4-counter=3089,ija-a4-cooldown=1}] run function ija-one-block:generated/phase/spawn-upgrade-entities
execute as @s[scores={ija-a4-counter=3089,ija-a4-cooldown=1}] run setblock ~ ~ ~ minecraft:bedrock

execute as @s[scores={ija-a4-counter=3090..3925,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 run function ija-one-block:generated/phase/07
scoreboard players set @s[scores={ija-a4-counter=3926,ija-a4-cooldown=1}] ija-a4-upgrade 1600
execute as @s[scores={ija-a4-counter=3926,ija-a4-cooldown=1}] run function ija-one-block:generated/phase/spawn-upgrade-entities
execute as @s[scores={ija-a4-counter=3926,ija-a4-cooldown=1}] run setblock ~ ~ ~ minecraft:bedrock

execute as @s[scores={ija-a4-counter=3927..4657,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 run function ija-one-block:generated/phase/08
scoreboard players set @s[scores={ija-a4-counter=4658,ija-a4-cooldown=1}] ija-a4-upgrade 1800
execute as @s[scores={ija-a4-counter=4658,ija-a4-cooldown=1}] run function ija-one-block:generated/phase/spawn-upgrade-entities
execute as @s[scores={ija-a4-counter=4658,ija-a4-cooldown=1}] run setblock ~ ~ ~ minecraft:bedrock

execute as @s[scores={ija-a4-counter=4659..5445,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 run function ija-one-block:generated/phase/09
scoreboard players set @s[scores={ija-a4-counter=5446,ija-a4-cooldown=1}] ija-a4-upgrade 2000
execute as @s[scores={ija-a4-counter=5446,ija-a4-cooldown=1}] run function ija-one-block:generated/phase/spawn-upgrade-entities
execute as @s[scores={ija-a4-counter=5446,ija-a4-cooldown=1}] run setblock ~ ~ ~ minecraft:bedrock

execute as @s[scores={ija-a4-counter=5447..6301,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 run function ija-one-block:generated/phase/10
scoreboard players set @s[scores={ija-a4-counter=6302,ija-a4-cooldown=1}] ija-a4-upgrade 2200
execute as @s[scores={ija-a4-counter=6302,ija-a4-cooldown=1}] run function ija-one-block:generated/phase/spawn-upgrade-entities
execute as @s[scores={ija-a4-counter=6302,ija-a4-cooldown=1}] run setblock ~ ~ ~ minecraft:bedrock
execute as @s[scores={ija-a4-counter=6300,ija-a4-cooldown=1}] at @s align xz positioned ~0.5 ~ ~0.5 unless block ~2 ~-2 ~ minecraft:end_portal_frame run function ija-one-block:end-portal/spawn

scoreboard players set @s[scores={ija-a4-counter=6305..,ija-a4-cooldown=1}] ija-a4-counter 6304
execute as @s[scores={ija-a4-counter=6303..,ija-a4-cooldown=1}] at @s run function ija-one-block:generated/phase/afterphases

execute if entity @e[tag=ija-a4-lang-de,scores={ija-a4-counter=6303,ija-a4-cooldown=1}] run tellraw @a [{"text":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n Du hast die Nachphasen erreicht!","color":"gold"},{"text":"\n Der unendliche Block pulsiert mit seltsamer Energie.","color":"yellow"},{"text":"\n  ➡ Klicke um die Einstellungen zu öffnen.","italic":"true","color":"gray","clickEvent":{"action":"run_command","value":"/trigger ija-a4-trigger set 1"},"hoverEvent":{"action":"show_text","value":"Öffne die\nEinstellungen."}}]
execute if entity @e[tag=ija-a4-lang-en,scores={ija-a4-counter=6303,ija-a4-cooldown=1}] run tellraw @a [{"text":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n You reached the Afterphases!","color":"gold"},{"text":"\n The infinite block pulsates with strange energy.","color":"yellow"},{"text":"\n  ➡ Click to open the settings.","italic":"true","color":"gray","clickEvent":{"action":"run_command","value":"/trigger ija-a4-trigger set 1"},"hoverEvent":{"action":"show_text","value":"Open the\nsettings menu."}}]