######################################################################################################### *** PHASE 3 - CAVES *** ##########################################################################################################



# BIOME SET #

execute if score fake_player ib_minedcount matches 261 run function simply_oneblock:ib_biomefill/dripstone_caves

execute if score fake_player ib_minedcount matches 261 run tellraw @a ["",{"text":"\n\n\n\n\n\n\n\nThe block's energy seems to have changed again","italic":true,"color":"gray"},{"text":"\n\n"},{"text":"Without being icy, you feel that the temperature around you has dropped, as if the sun's rays are no longer providing any warmth. The sky has lost its soft blue colour, giving way to a dark, oppressive grey. Without being able to explain why, you can't shake the feeling that there's a dangerous presence at your back.","color":"aqua"}]



# GRAVITY WARNING #

execute if entity @e[type=minecraft:falling_block,x=0,y=64,z=0] run tellraw @a {"text":"\n\n\n\n\n\n\n\nSome blocks are subject to gravity, placing a solid block under the infinite block should help","italic":true,"color":"yellow"}



# PARTICLE #

kill @e[type=area_effect_cloud,x=0,y=64,z=0]
summon area_effect_cloud 0.5 65.5 0.5 {custom_particle:{type:ash},Radius:0.2,Duration:100000}



# BLOCK RANDOMIZER #

# Random selector #

execute if score fake_player ib_minedcount matches 261..549 store result score fake_player ib_randomizer run random value 1..100

execute if score fake_player ib_randomizer matches 1..20 run setblock 0 64 0 minecraft:stone
execute if score fake_player ib_randomizer matches 21..30 run setblock 0 64 0 minecraft:diorite
execute if score fake_player ib_randomizer matches 31..40 run setblock 0 64 0 minecraft:andesite
execute if score fake_player ib_randomizer matches 41..50 run setblock 0 64 0 minecraft:granite
execute if score fake_player ib_randomizer matches 51..60 run setblock 0 64 0 minecraft:gravel
execute if score fake_player ib_randomizer matches 61..70 run setblock 0 64 0 minecraft:deepslate
execute if score fake_player ib_randomizer matches 71..75 run setblock 0 64 0 minecraft:coal_ore
execute if score fake_player ib_randomizer matches 76..77 run setblock 0 64 0 minecraft:deepslate_coal_ore
execute if score fake_player ib_randomizer matches 78..81 run setblock 0 64 0 minecraft:copper_ore
execute if score fake_player ib_randomizer matches 82..83 run setblock 0 64 0 minecraft:deepslate_copper_ore
execute if score fake_player ib_randomizer matches 84..87 run setblock 0 64 0 minecraft:iron_ore
execute if score fake_player ib_randomizer matches 88..89 run setblock 0 64 0 minecraft:deepslate_iron_ore
execute if score fake_player ib_randomizer matches 90..91 run setblock 0 64 0 minecraft:gold_ore
execute if score fake_player ib_randomizer matches 92 run setblock 0 64 0 minecraft:deepslate_gold_ore
execute if score fake_player ib_randomizer matches 93..94 run setblock 0 64 0 minecraft:lapis_ore
execute if score fake_player ib_randomizer matches 95 run setblock 0 64 0 minecraft:deepslate_lapis_ore
execute if score fake_player ib_randomizer matches 96..97 run setblock 0 64 0 minecraft:redstone_ore
execute if score fake_player ib_randomizer matches 98 run setblock 0 64 0 minecraft:deepslate_redstone_ore
execute if score fake_player ib_randomizer matches 99 run setblock 0 64 0 minecraft:diamond_ore
execute if score fake_player ib_randomizer matches 100 run setblock 0 64 0 minecraft:deepslate_diamond_ore

# Forced Sequence #

execute if score fake_player ib_minedcount matches 261 run setblock 0 64 0 minecraft:stone replace
execute if score fake_player ib_minedcount matches 262 run setblock 0 64 0 minecraft:stone replace
execute if score fake_player ib_minedcount matches 263 run setblock 0 64 0 minecraft:stone replace
execute if score fake_player ib_minedcount matches 264 run setblock 0 64 0 minecraft:stone replace
execute if score fake_player ib_minedcount matches 265 run setblock 0 64 0 minecraft:stone replace
execute if score fake_player ib_minedcount matches 266 run setblock 0 64 0 minecraft:coal_ore replace
execute if score fake_player ib_minedcount matches 267 run setblock 0 64 0 minecraft:stone replace
execute if score fake_player ib_minedcount matches 268 run setblock 0 64 0 minecraft:coal_ore replace
execute if score fake_player ib_minedcount matches 269 run setblock 0 64 0 minecraft:stone replace
execute if score fake_player ib_minedcount matches 270 run setblock 0 64 0 minecraft:iron_ore replace
execute if score fake_player ib_minedcount matches 271 run setblock 0 64 0 minecraft:iron_ore replace
execute if score fake_player ib_minedcount matches 272 run setblock 0 64 0 minecraft:stone replace
execute if score fake_player ib_minedcount matches 273 run setblock 0 64 0 minecraft:iron_ore replace
execute if score fake_player ib_minedcount matches 274 run setblock 0 64 0 minecraft:iron_ore replace
execute if score fake_player ib_minedcount matches 275 run setblock 0 64 0 minecraft:iron_ore replace
execute if score fake_player ib_minedcount matches 276 run setblock 0 64 0 minecraft:stone replace
execute if score fake_player ib_minedcount matches 277 run setblock 0 64 0 minecraft:stone replace
execute if score fake_player ib_minedcount matches 278 run setblock 0 64 0 minecraft:stone replace



# CHESTS #

execute if score fake_player ib_minedcount matches 308 run setblock 0 64 0 chest{LootTable:"simply_oneblock:caves"} replace
execute as @e[y=64,dy=1] at @s if score fake_player ib_minedcount matches 309 run teleport @s 0 65 0

execute if score fake_player ib_minedcount matches 356 run setblock 0 64 0 chest{LootTable:"simply_oneblock:caves"} replace
execute as @e[y=64,dy=1] at @s if score fake_player ib_minedcount matches 357 run teleport @s 0 65 0

execute if score fake_player ib_minedcount matches 404 run setblock 0 64 0 chest{LootTable:"simply_oneblock:caves"} replace
execute as @e[y=64,dy=1] at @s if score fake_player ib_minedcount matches 405 run teleport @s 0 65 0

execute if score fake_player ib_minedcount matches 452 run setblock 0 64 0 chest{LootTable:"simply_oneblock:caves"} replace
execute as @e[y=64,dy=1] at @s if score fake_player ib_minedcount matches 453 run teleport @s 0 65 0

execute if score fake_player ib_minedcount matches 500 run setblock 0 64 0 chest{LootTable:"simply_oneblock:caves"} replace
execute as @e[y=64,dy=1] at @s if score fake_player ib_minedcount matches 501 run teleport @s 0 65 0

execute if score fake_player ib_minedcount matches 546 run setblock 0 64 0 chest{LootTable:"simply_oneblock:caves"} replace
execute as @e[y=64,dy=1] at @s if score fake_player ib_minedcount matches 547 run teleport @s 0 65 0



# MOBS RANDOMIZER #

# Zombie #

execute if score fake_player ib_minedcount matches 296 store result score fake_player ib_mob_randomizer run random value 1..100
execute if score fake_player ib_minedcount matches 296 run playsound minecraft:entity.player.teleport block @a 0 66 0
execute if score fake_player ib_minedcount matches 296 run playsound minecraft:entity.zombie.ambient block @a 0 66 0

execute if score fake_player ib_minedcount matches 296 run summon minecraft:zombie 0 66 0 {CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 296 run summon minecraft:zombie 0 66 0 {CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 296 if score fake_player ib_mob_randomizer matches 1..50 run summon minecraft:zombie 0 66 0 {CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 296 if score fake_player ib_mob_randomizer matches 51..100 run summon minecraft:zombie 0 66 0 {IsBaby:1,CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 296 if score fake_player ib_mob_randomizer matches 36..65 run summon minecraft:zombie 0 66 0 {CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 296 if score fake_player ib_mob_randomizer matches 1..35 run summon minecraft:zombie 0 66 0 {IsBaby:1,CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 296 if score fake_player ib_mob_randomizer matches 66..100 run summon minecraft:zombie 0 66 0 {IsBaby:1,CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}

# Spider #

execute if score fake_player ib_minedcount matches 331 store result score fake_player ib_mob_randomizer run random value 1..100
execute if score fake_player ib_minedcount matches 331 run playsound minecraft:entity.player.teleport block @a 0 66 0
execute if score fake_player ib_minedcount matches 331 run playsound minecraft:entity.spider.ambient block @a 0 66 0

execute if score fake_player ib_minedcount matches 331 run summon minecraft:spider 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 331 run summon minecraft:spider 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 331 run summon minecraft:spider 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 331 run summon minecraft:spider 0 66 0 {PersistenceRequired:1b}

# Creeper #

execute if score fake_player ib_minedcount matches 366 store result score fake_player ib_mob_randomizer run random value 1..100
execute if score fake_player ib_minedcount matches 366 run playsound minecraft:entity.player.teleport block @a 0 66 0
execute if score fake_player ib_minedcount matches 366 run playsound minecraft:block.fire.extinguish block @a 0 66 0

execute if score fake_player ib_minedcount matches 366 run summon minecraft:creeper 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 366 run summon minecraft:creeper 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 366 run summon minecraft:creeper 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 366 run summon minecraft:creeper 0 66 0 {PersistenceRequired:1b}

# Skeleton #

execute if score fake_player ib_minedcount matches 401 store result score fake_player ib_mob_randomizer run random value 1..100
execute if score fake_player ib_minedcount matches 401 run playsound minecraft:entity.player.teleport block @a 0 66 0
execute if score fake_player ib_minedcount matches 401 run playsound minecraft:entity.skeleton.ambient block @a 0 66 0

execute if score fake_player ib_minedcount matches 401 run summon minecraft:skeleton 0 66 0 {PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}
execute if score fake_player ib_minedcount matches 401 run summon minecraft:skeleton 0 66 0 {PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}
execute if score fake_player ib_minedcount matches 401 run summon minecraft:skeleton 0 66 0 {PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}
execute if score fake_player ib_minedcount matches 401 run summon minecraft:skeleton 0 66 0 {PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}

# Zombie #

execute if score fake_player ib_minedcount matches 436 store result score fake_player ib_mob_randomizer run random value 1..100
execute if score fake_player ib_minedcount matches 436 run playsound minecraft:entity.player.teleport block @a 0 66 0
execute if score fake_player ib_minedcount matches 436 run playsound minecraft:entity.zombie.ambient block @a 0 66 0

execute if score fake_player ib_minedcount matches 436 run summon minecraft:zombie 0 66 0 {CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 436 run summon minecraft:zombie 0 66 0 {CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 436 run summon minecraft:zombie 0 66 0 {CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 436 run summon minecraft:zombie 0 66 0 {CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 436 if score fake_player ib_mob_randomizer matches 1..50 run summon minecraft:zombie 0 66 0 {CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 436 if score fake_player ib_mob_randomizer matches 15..35 run summon minecraft:chicken 0 66 0 {variant:temperate,IsChickenJockey:1,Passengers:[{id:zombie,IsBaby:1,CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}]}
execute if score fake_player ib_minedcount matches 436 if score fake_player ib_mob_randomizer matches 51..100 run summon minecraft:zombie 0 66 0 {IsBaby:1,CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 436 if score fake_player ib_mob_randomizer matches 65..85 run summon minecraft:chicken 0 66 0 {variant:temperate,IsChickenJockey:1,Passengers:[{id:zombie,IsBaby:1,CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}]}
execute if score fake_player ib_minedcount matches 436 if score fake_player ib_mob_randomizer matches 36..65 run summon minecraft:zombie 0 66 0 {CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 436 if score fake_player ib_mob_randomizer matches 1..35 run summon minecraft:zombie 0 66 0 {IsBaby:1,CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}
execute if score fake_player ib_minedcount matches 436 if score fake_player ib_mob_randomizer matches 66..100 run summon minecraft:chicken 0 66 0 {variant:temperate,IsChickenJockey:1,Passengers:[{id:zombie,IsBaby:1,CanBreakDoors:1,CanPickUpLoot:1b,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}]}]}

# Skeleton #

execute if score fake_player ib_minedcount matches 471 store result score fake_player ib_mob_randomizer run random value 1..100
execute if score fake_player ib_minedcount matches 471 run playsound minecraft:entity.player.teleport block @a 0 66 0
execute if score fake_player ib_minedcount matches 471 run playsound minecraft:entity.spider.ambient block @a 0 66 0

execute if score fake_player ib_minedcount matches 471 run playsound minecraft:entity.skeleton.ambient block @a 0 66 0
execute if score fake_player ib_minedcount matches 471 run summon minecraft:spider 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 471 run summon minecraft:spider 0 66 0 {Passengers:[{id:skeleton,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}]}
execute if score fake_player ib_minedcount matches 471 run summon minecraft:spider 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 471 run summon minecraft:spider 0 66 0 {Passengers:[{id:skeleton,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}]}
execute if score fake_player ib_minedcount matches 471 run summon minecraft:spider 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 471 run summon minecraft:spider 0 66 0 {Passengers:[{id:skeleton,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}]}
execute if score fake_player ib_minedcount matches 471 run summon minecraft:spider 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 471 run summon minecraft:spider 0 66 0 {Passengers:[{id:skeleton,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}]}

# Creeper #

execute if score fake_player ib_minedcount matches 506 store result score fake_player ib_mob_randomizer run random value 1..100
execute if score fake_player ib_minedcount matches 506 run playsound minecraft:entity.player.teleport block @a 0 66 0
execute if score fake_player ib_minedcount matches 506 run playsound minecraft:block.fire.extinguish block @a 0 66 0

execute if score fake_player ib_minedcount matches 506 run summon minecraft:creeper 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 506 run summon minecraft:creeper 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 506 run summon minecraft:creeper 0 66 0 {PersistenceRequired:1b}
execute if score fake_player ib_minedcount matches 506 run summon minecraft:creeper 0 66 0 {PersistenceRequired:1b}

# Spider #

execute if score fake_player ib_minedcount matches 541 store result score fake_player ib_mob_randomizer run random value 1..100
execute if score fake_player ib_minedcount matches 541 run playsound minecraft:entity.player.teleport block @a 0 66 0
execute if score fake_player ib_minedcount matches 541 run playsound minecraft:entity.skeleton.ambient block @a 0 66 0

execute if score fake_player ib_minedcount matches 541 run playsound minecraft:entity.spider.ambient block @a 0 66 0
execute if score fake_player ib_minedcount matches 541 run summon minecraft:skeleton 0 66 0 {PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}
execute if score fake_player ib_minedcount matches 541 run summon minecraft:skeleton 0 66 0 {PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}
execute if score fake_player ib_minedcount matches 541 run summon minecraft:skeleton 0 66 0 {PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}
execute if score fake_player ib_minedcount matches 541 run summon minecraft:skeleton 0 66 0 {PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}
execute if score fake_player ib_minedcount matches 541 run summon minecraft:spider 0 66 0 {Passengers:[{id:skeleton,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}]}
execute if score fake_player ib_minedcount matches 541 run summon minecraft:spider 0 66 0 {Passengers:[{id:skeleton,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}]}
execute if score fake_player ib_minedcount matches 541 run summon minecraft:spider 0 66 0 {Passengers:[{id:skeleton,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}]}
execute if score fake_player ib_minedcount matches 541 run summon minecraft:spider 0 66 0 {Passengers:[{id:skeleton,PersistenceRequired:1b,active_effects:[{id:fire_resistance,duration:24000,show_particles:0b}],equipment:{mainhand:{id:bow,count:1}}}]}


