##this function affects only the center half of the corruption - the first ~12 blocks radius

#summon 2 spawners randomly, with each corner having a 25% chance to have one spawned near it
execute at @e[type=marker,distance=..20,tag=KyuBioCor,limit=2,sort=random] run function zzzzdonotuse:biomecorruption/colorfulcorruption/placespawner
execute positioned ~11 ~ ~11 run execute if predicate suhc:25percent run execute at @e[type=marker,distance=..5,tag=KyuBioCor,limit=1,sort=random] run function zzzzdonotuse:biomecorruption/colorfulcorruption/placespawner
execute positioned ~-11 ~ ~11 run execute if predicate suhc:25percent run execute at @e[type=marker,distance=..5,tag=KyuBioCor,limit=1,sort=random] run function zzzzdonotuse:biomecorruption/colorfulcorruption/placespawner
execute positioned ~11 ~ ~-11 run execute if predicate suhc:25percent run execute at @e[type=marker,distance=..5,tag=KyuBioCor,limit=1,sort=random] run function zzzzdonotuse:biomecorruption/colorfulcorruption/placespawner
execute positioned ~-11 ~ ~-11 run execute if predicate suhc:25percent run execute at @e[type=marker,distance=..5,tag=KyuBioCor,limit=1,sort=random] run function zzzzdonotuse:biomecorruption/colorfulcorruption/placespawner






#remove the tags the markers have, replace it with a name
execute as @e[type=marker,tag=KyuBioCor,distance=..20] run data merge entity @s {CustomName:"\"KyuBioCor\""}
execute as @e[type=marker,tag=KyuBioCor,distance=..20] run tag @s remove KyuBioCor

#tags markers that do not have any tags - the limit is based on the total amount of markers that make up the inner circle
##1-16 in the tag name corresponds to the terracotta color, the N/S/E/W correspond to if the blocks will be facing North/South/East/West
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot1N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot2N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot3N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot4N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot5N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot6N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot7N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot8N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot9N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot10N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot11N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot12N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot13N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot14N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot15N
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=8,sort=random] add Terracot16N

tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot1S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot2S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot3S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot4S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot5S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot6S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot7S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot8S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot9S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot10S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot11S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot12S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot13S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot14S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot15S
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot16S

tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot1E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot2E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot3E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot4E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot5E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot6E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot7E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot8E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot9E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot10E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot11E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot12E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot13E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot14E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot15E
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot16E

tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot1W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot2W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot3W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot4W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot5W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot6W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot7W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot8W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot9W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot10W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot11W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot12W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot13W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot14W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot15W
tag @e[type=marker,distance=..20,tag=,name=KyuBioCor,limit=7,sort=random] add Terracot16W


execute at @e[type=marker,distance=..20,name=KyuBioCor] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:command_block{auto:1b,Command:"function zzzzdonotuse:biomecorruption/colorfulcorruption/treereplace",TrackOutput:0} replace minecraft:spruce_log


#based on each marker's tags...replace blocks with the correct terracotta
execute at @e[type=marker,distance=..20,tag=Terracot1S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:white_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot2S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:orange_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot3S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:magenta_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot4S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:light_blue_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot5S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:yellow_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot6S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:lime_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot7S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:pink_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot8S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:gray_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot9S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:light_gray_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot10S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:cyan_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot11S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:purple_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot12S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:blue_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot13S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:brown_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot14S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:green_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot15S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:red_glazed_terracotta[facing=south] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot16S] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:black_glazed_terracotta[facing=south] replace #suhc:solidblocks

execute at @e[type=marker,distance=..20,tag=Terracot1N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:white_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot2N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:orange_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot3N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:magenta_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot4N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:light_blue_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot5N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:yellow_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot6N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:lime_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot7N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:pink_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot8N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:gray_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot9N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:light_gray_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot10N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:cyan_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot11N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:purple_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot12N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:blue_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot13N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:brown_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot14N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:green_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot15N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:red_glazed_terracotta[facing=north] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot16N] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:black_glazed_terracotta[facing=north] replace #suhc:solidblocks

execute at @e[type=marker,distance=..20,tag=Terracot1E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:white_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot2E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:orange_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot3E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:magenta_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot4E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:light_blue_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot5E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:yellow_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot6E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:lime_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot7E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:pink_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot8E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:gray_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot9E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:light_gray_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot10E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:cyan_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot11E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:purple_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot12E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:blue_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot13E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:brown_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot14E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:green_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot15E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:red_glazed_terracotta[facing=east] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot16E] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:black_glazed_terracotta[facing=east] replace #suhc:solidblocks

execute at @e[type=marker,distance=..20,tag=Terracot1W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:white_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot2W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:orange_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot3W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:magenta_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot4W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:light_blue_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot5W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:yellow_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot6W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:lime_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot7W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:pink_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot8W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:gray_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot9W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:light_gray_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot10W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:cyan_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot11W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:purple_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot12W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:blue_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot13W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:brown_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot14W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:green_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot15W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:red_glazed_terracotta[facing=west] replace #suhc:solidblocks
execute at @e[type=marker,distance=..20,tag=Terracot16W] run fill ~ ~-15 ~ ~ ~15 ~ minecraft:black_glazed_terracotta[facing=west] replace #suhc:solidblocks

#die
execute as @e[type=marker,distance=..20,name=KyuBioCor] run kill @s