#if the block below the marker is leaves, or any NON-SOLID block(air, grass, water, etc.), move it down and place a mushroom stem and a ladder on that stem
execute if block ~ ~-1 ~ #minecraft:leaves run tp @s ~ ~-1 ~
setblock ~ ~ ~ mushroom_stem
setblock ~ ~ ~1 ladder[facing=south]
execute if block ~ ~-1 ~ #suhc:bloodboltpassthrough run tp @s ~ ~-1 ~
setblock ~ ~ ~ mushroom_stem
setblock ~ ~ ~1 ladder[facing=south]

#tick a scoreboard up and run the function up to 60 times, allowing the stem to extend 20 blocks downwards beyond the main structure if required
scoreboard players add @s KyuDummy 1
kill @s[scores={KyuDummy=61..}]
execute as @s[scores={KyuDummy=..60}] run execute at @s run function zzzzdonotuse:structures/mushroomhouse/movedown
