

#										Датапак — «Island Skyblock»
#										Версия — 1.0 для 1.20.x
#										Автор — Ardixar


#1 Создание портала в Энд
#1.1 Скорборд для проверки расположения блоков обсидиана и воздуха
scoreboard objectives add end_portal_create dummy

#1.2 Проверка обсидиана и запись результата
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~2 ~ ~ minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~2 ~ ~1 minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~2 ~ ~-1 minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1

execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~-2 ~ ~ minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~-2 ~ ~1 minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~-2 ~ ~-1 minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1

execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~ ~ ~2 minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~1 ~ ~2 minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~-1 ~ ~2 minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1

execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~ ~ ~-2 minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~1 ~ ~-2 minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~-1 ~ ~-2 minecraft:obsidian run scoreboard players add end_portal_create end_portal_create 1

#1.3 Проверка воздушной прослойки и запись результата
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~1 ~ ~ air run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~ ~ ~1 air run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~1 ~ ~1 air run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~-1 ~ ~ air run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~ ~ ~-1 air run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~-1 ~ ~-1 air run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~-1 ~ ~1 air run scoreboard players add end_portal_create end_portal_create 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if block ~1 ~ ~-1 air run scoreboard players add end_portal_create end_portal_create 1

#1.4 Звуки размещения портала
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run playsound minecraft:entity.ender_dragon.growl master @a ~ ~ ~ 1
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run playsound minecraft:entity.generic.explode master @a ~ ~ ~ 1 0.8

#1.5 Визуальные частица размещения портала
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run particle minecraft:explosion ~2 ~1 ~1 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run particle minecraft:explosion ~2 ~1 ~-1 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run particle minecraft:explosion ~-2 ~1 ~1 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run particle minecraft:explosion ~-2 ~1 ~-1 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run particle minecraft:explosion ~1 ~1 ~2 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run particle minecraft:explosion ~1 ~1 ~-2 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run particle minecraft:explosion ~-1 ~1 ~2 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run particle minecraft:explosion ~-1 ~1 ~-2 0.1 0.1 0.1 0 4

#1.6 Размещение портала, если результат полный
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run fill ~2 ~ ~1 ~2 ~ ~-1 minecraft:end_portal_frame[facing=west]
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run fill ~-2 ~ ~1 ~-2 ~ ~-1 minecraft:end_portal_frame[facing=east]
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run fill ~-1 ~ ~2 ~1 ~ ~2 minecraft:end_portal_frame[facing=north]
execute at @e[type=minecraft:item,nbt={Item:{id:"minecraft:ghast_tear",Count:1b}},limit=1,nbt={Fire:160s}] if dimension minecraft:overworld if score end_portal_create end_portal_create matches 20 run fill ~-1 ~ ~-2 ~1 ~ ~-2 minecraft:end_portal_frame[facing=south]

#1.7 Постоянный сброс результата проверки
execute if score end_portal_create end_portal_create matches 1.. run scoreboard players reset end_portal_create end_portal_create

#2 Уничтожение портала в Энд
#2.1 Скорборд для проверки расположения блоков рамок портала в Энд
scoreboard objectives add end_portal_destroy dummy

#2.2 Проверка рамок портала в Энд и запись результата
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~2 ~-2 ~ minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~2 ~-2 ~1 minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~2 ~-2 ~-1 minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1

execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~-2 ~-2 ~ minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~-2 ~-2 ~1 minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~-2 ~-2 ~-1 minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1

execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~ ~-2 ~2 minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~1 ~-2 ~2 minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~-1 ~-2 ~2 minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1

execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~ ~-2 ~-2 minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~1 ~-2 ~-2 minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if block ~-1 ~-2 ~-2 minecraft:end_portal_frame run scoreboard players add end_portal_destroy end_portal_destroy 1

#2.3 Звуки разрушения портала
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run playsound minecraft:entity.ender_dragon.growl master @a ~ ~ ~ 1
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run playsound minecraft:entity.generic.explode master @a ~ ~ ~ 1 0.8

#2.4 Визуальные частицы разрушения портала
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run particle minecraft:explosion ~2 ~1 ~1 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run particle minecraft:explosion ~2 ~1 ~-1 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run particle minecraft:explosion ~-2 ~1 ~1 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run particle minecraft:explosion ~-2 ~1 ~-1 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run particle minecraft:explosion ~1 ~1 ~2 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run particle minecraft:explosion ~1 ~1 ~-2 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run particle minecraft:explosion ~-1 ~1 ~2 0.1 0.1 0.1 0 4
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run particle minecraft:explosion ~-1 ~1 ~-2 0.1 0.1 0.1 0 4

#2.5 Разрушение портала, если результат полный
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run fill ~2 ~-2 ~1 ~2 ~-2 ~-1 air destroy
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run fill ~-2 ~-2 ~1 ~-2 ~-2 ~-1 air destroy
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run fill ~-1 ~-2 ~2 ~1 ~-2 ~2 air destroy
execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run fill ~-1 ~-2 ~-2 ~1 ~-2 ~-2 air destroy

execute at @e[type=minecraft:lightning_bolt] if dimension minecraft:overworld if score end_portal_destroy end_portal_destroy matches 12 run fill ~-1 ~-2 ~-1 ~1 ~-2 ~1 air replace minecraft:end_portal

#2.6 Постоянный сброс результата проверки
execute if score end_portal_destroy end_portal_destroy matches 1.. run scoreboard players reset end_portal_destroy end_portal_destroy