tag @s add DoBirchSpawn



execute as @s[tag=DoBirchSpawn] run execute at @s run tp @s ~-4 66 ~18


#if the main marker has the tag from above, run the spreadlava functions in the middle of each quadrant of the structure, resetting the scoreboard after each run
execute as @s[tag=DoBirchSpawn] run execute at @s run execute positioned ~-11 ~ ~7 run function zzzzdonotuse:structures/birchtavern/spreadlava
scoreboard players set @s KyuDummy 0
execute as @s[tag=DoBirchSpawn] run execute at @s run execute positioned ~6 ~ ~7 run function zzzzdonotuse:structures/birchtavern/spreadlava
scoreboard players set @s KyuDummy 0
execute as @s[tag=DoBirchSpawn] run execute at @s run execute positioned ~6 ~ ~-2 run function zzzzdonotuse:structures/birchtavern/spreadlava
scoreboard players set @s KyuDummy 0
execute as @s[tag=DoBirchSpawn] run execute at @s run execute positioned ~-11 ~ ~-2 run function zzzzdonotuse:structures/birchtavern/spreadlava
scoreboard players set @s KyuDummy 0

#executing as(and at) each of the armor stands that survived the spreadlava function: Fill in a small section of the ground with lava, several blocks above that with air, and destroy any trees going all the way to 130y 
##execute as @e[type=armor_stand,tag=BirchTavernLava] run execute at @s run tp @s ~ 62 ~
execute as @e[type=armor_stand,tag=BirchTavernLava] run execute at @s run fill ~-3 66 ~ ~3 66 ~ lava
execute as @e[type=armor_stand,tag=BirchTavernLava] run execute at @s run fill ~ 66 ~-3 ~ 66 ~3 lava
execute as @e[type=armor_stand,tag=BirchTavernLava] run execute at @s run fill ~1 66 ~2 ~-1 66 ~-2 lava
execute as @e[type=armor_stand,tag=BirchTavernLava] run execute at @s run fill ~2 66 ~1 ~-2 66 ~-1 lava
execute as @e[type=armor_stand,tag=BirchTavernLava] run execute at @s run fill ~2 67 ~2 ~-2 130 ~-2 air replace #minecraft:logs
execute as @e[type=armor_stand,tag=BirchTavernLava] run execute at @s run fill ~2 67 ~2 ~-2 130 ~-2 fire replace #minecraft:leaves
execute as @e[type=armor_stand,tag=BirchTavernLava] run execute at @s run fill ~-3 67 ~ ~3 83 ~ air
execute as @e[type=armor_stand,tag=BirchTavernLava] run execute at @s run fill ~ 67 ~-3 ~ 83 ~3 air
execute as @e[type=armor_stand,tag=BirchTavernLava] run execute at @s run fill ~1 67 ~2 ~-1 83 ~-2 air
execute as @e[type=armor_stand,tag=BirchTavernLava] run execute at @s run fill ~2 67 ~1 ~-2 83 ~-1 air

#kill all the entities, minus the main armor stand
kill @e[type=armor_stand,tag=BirchTavernLava]
kill @e[type=marker,tag=TavernCheck]

#if the main marker has the tag from way above, summon the structure
execute as @s[tag=DoBirchSpawn] run execute at @s run setblock ~ 67 ~ minecraft:structure_block[mode=load]{name:"suhc:birchfieldtavern",posX:-20,posZ:-17,posY:-8,rotation:NONE,mirror:NONE,mode:LOAD,ignoreEntities:0b} destroy
execute as @s[tag=DoBirchSpawn] run execute at @s run setblock ~ 66 ~ minecraft:redstone_block

#removes the main marker's tag so nothing will attempt to spawn on it in the future, however it is not killed for...future reasons
tag @s remove DoBirchSpawn
