#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#
#    This function has been created by Skilendarz Group.
#             https://skilendarz.com
#
#      GIVE MAP MAKERS THE CREDIT THEY DESERVE!
#             COPYING IS PROHIBITED!
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

execute if score option_time time matches ..20 if entity @e[tag=option_time-,nbt=!{ArmorItems:[{},{},{},{id:"minecraft:birch_planks"}]}] run scoreboard players set option_time time 100
execute if score option_time time matches ..20 if entity @e[tag=option_time+,nbt=!{ArmorItems:[{},{},{},{id:"minecraft:birch_planks"}]}] run scoreboard players set option_time time 101

clear @a birch_planks

particle minecraft:dust 0 1 0 1 315 107.8 -345 0.1 0 0.1 0 1

#score
execute if score option_time time matches 100 run scoreboard players remove option_time pumpkins 1
execute if score option_time time matches 101 run scoreboard players add option_time pumpkins 1
execute if score option_time time matches 100.. run scoreboard players set option_time time 58
execute if score option_time time matches 1.. run scoreboard players remove option_time time 1

#change value
execute if score option_time time matches 57 run playsound minecraft:block.wood.break master @a 316.1 107.70 -344.5 1 0.7
execute if score option_time time matches 57 run particle minecraft:block oak_planks 316.1 107.70 -344.5 0 0.05 0.1 0 40
execute if score option_time time matches 57 run item replace entity @e[tag=option_time] armor.head with air

execute if score option_time time matches 57 run scoreboard players set @e[tag=option_selected_time] time 1000
execute if score option_time time matches 57 run scoreboard players set @e[tag=option_selected_time] main 100
execute if score option_time time matches 53 run playsound minecraft:ambient.underwater.enter master @a 315 107 -345 1 2
execute if score option_time time matches 50 run kill @e[tag=option_selected_time]

execute if score option_time time matches 55 run playsound minecraft:block.bubble_column.upwards_ambient master @a 315 107 -345
execute if score option_time time matches 44..55 run particle entity_effect 315 107.8 -345 0 1 0 0.5 0
execute if score option_time time matches 54..55 as @e[tag=time_cauldron] at @s run tp @s ~ ~ ~ ~ ~2.5
execute if score option_time time matches 50..53 as @e[tag=time_cauldron] at @s run tp @s ~ ~ ~ ~ ~-2.5
execute if score option_time time matches 46..49 as @e[tag=time_cauldron] at @s run tp @s ~ ~ ~ ~ ~2.5
execute if score option_time time matches 44..45 as @e[tag=time_cauldron] at @s run tp @s ~ ~ ~ ~ ~-2.5

execute if score option_time time matches 41 run particle minecraft:smoke 315 107.8 -345 0 0 0 0.15 100
execute if score option_time time matches 41 run playsound minecraft:block.lava.extinguish master @a 315 107 -345
execute if score option_time time matches 41 run playsound minecraft:ambient.underwater.exit master @a 315 107 -345 1 2
execute if score option_time time matches 44 run summon minecraft:armor_stand 315 106.6 -345 {Tags:["option_selected","option_selected_time"],Invisible:1,NoGravity:1,Small:1,Marker:1,Passengers:[{id:"armor_stand",Marker:1,Invisible:1,Small:1,Tags:["option_selected","option_selected_time","option_selected_time2"]}]}

execute if score option_time time matches 44 if score option_time pumpkins matches -4 run item replace entity @e[tag=option_selected_time] armor.head with minecraft:lime_dye{CustomModelData:19}
execute if score option_time time matches 44 if score option_time pumpkins matches -3 run item replace entity @e[tag=option_selected_time] armor.head with minecraft:lime_dye{CustomModelData:18}
execute if score option_time time matches 44 if score option_time pumpkins matches -2 run item replace entity @e[tag=option_selected_time] armor.head with minecraft:lime_dye{CustomModelData:17}
execute if score option_time time matches 44 if score option_time pumpkins matches -1 run item replace entity @e[tag=option_selected_time] armor.head with minecraft:lime_dye{CustomModelData:16}
execute if score option_time time matches 44 if score option_time pumpkins matches 0 run item replace entity @e[tag=option_selected_time] armor.head with minecraft:lime_dye{CustomModelData:15}
execute if score option_time time matches 44 run item replace entity @e[tag=option_selected_time2] armor.head with minecraft:cyan_stained_glass

execute if score option_time time matches 44 as @e[tag=option_selected_time] store result score @s hitbox_y run data get entity @s Pos[1] 2000
execute if score option_time time matches 44 run scoreboard players set @e[tag=option_selected_time] main 150
execute if score option_time time matches 1..43 run scoreboard players remove @e[tag=option_selected_time] main 3

scoreboard players add option_time pumpkins 0
execute if score option_time pumpkins matches 1.. run scoreboard players set option_time pumpkins -4
execute if score option_time pumpkins matches ..-5 run scoreboard players set option_time pumpkins 0

execute if score option_time time matches 20 if score option_time pumpkins matches -4 run item replace entity @e[tag=option_time_value] armor.head with minecraft:lime_dye{CustomModelData:20}
execute if score option_time time matches 20 if score option_time pumpkins matches -3 run item replace entity @e[tag=option_time_value] armor.head with minecraft:lime_dye{CustomModelData:21}
execute if score option_time time matches 20 if score option_time pumpkins matches -2 run item replace entity @e[tag=option_time_value] armor.head with minecraft:lime_dye{CustomModelData:22}
execute if score option_time time matches 20 if score option_time pumpkins matches -1 run item replace entity @e[tag=option_time_value] armor.head with minecraft:lime_dye{CustomModelData:23}
execute if score option_time time matches 20 if score option_time pumpkins matches 0 run item replace entity @e[tag=option_time_value] armor.head with minecraft:lime_dye{CustomModelData:24}
execute if score option_time time matches 20 run playsound minecraft:block.wood.place master @a 315 107 -345
execute if score option_time time matches ..20 run item replace entity @e[tag=option_time2] armor.head with minecraft:birch_planks{display:{Name:'{"text":""}'}}
