#summon a bunch of markers
summon minecraft:marker ~ ~ ~ {Tags:["TavernCheck"]}
summon minecraft:marker ~ ~ ~ {Tags:["TavernCheck"]}
summon minecraft:marker ~ ~ ~ {Tags:["TavernCheck"]}
summon minecraft:marker ~ ~ ~ {Tags:["TavernCheck"]}
summon minecraft:marker ~ ~ ~ {Tags:["TavernCheck"]}


#run execute if predicate suhc:biomes/tentbiomes

#spread the markers around
spreadplayers ~ ~ 10 60 false @e[type=marker,tag=TavernCheck]

##sometimes the markers get placed on blocks such as flowers or tall_grass, so move them down if so
#execute at @e[type=marker,tag=TavernCheck] positioned ~ ~ ~ run execute if block ~ ~-1 ~ #suhc:bloodboltpassthrough run execute at @s run tp @s ~ ~-1 ~
#execute at @e[type=marker,tag=TavernCheck] positioned ~ ~ ~ run execute if block ~ ~-1 ~ #suhc:bloodboltpassthrough run execute at @s run tp @s ~ ~-1 ~

#run the block-check function as(and at) each marker
execute as @e[type=marker,tag=TavernCheck] run execute at @s run function zzzzdonotuse:structures/birchtavern/birchtavernblockcheck

#teleport the main marker to a random marker from above that survived the function run(which checks the structure entrance[near the wooden sign] for appropriate spawning conditions)
tp @s @e[type=marker,tag=TavernCheck,limit=1,sort=random,distance=..150]

#if the main marker gets teleported successfuly to a marker with the appropriate conditions, give it a tag and teleport it(the particular X/Z coords are where the structure block is located in the structure.nbt)
#execute at @s run execute if entity @e[type=marker,tag=TavernCheck,distance=..4,scores={KyuDummy=9..}] run tag @s add DoBirchSpawn 
execute as @s run execute at @s run execute if entity @e[type=marker,tag=TavernCheck,distance=..4,scores={KyuDummy=9..}] run tag @s add GotPlaceSpot
execute as @s run execute at @s run execute if entity @e[type=marker,tag=TavernCheck,distance=..4,scores={KyuDummy=9..}] run tag @s add DoBirchSpawn
execute as @s run execute at @s run execute if entity @e[type=marker,tag=TavernCheck,distance=..4,scores={KyuDummy=9..}] run scoreboard players set @s KyuDummy5 20
kill @e[type=marker,tag=TavernCheck]
execute as @s run execute at @s[tag=DoBirchSpawn] run function zzzzdonotuse:structures/birchtavern/birchspawnstructure




