##############################
##
##        WorldEdit
##    Made By M7mdTG ;)
##
##############################

#stage 1
 
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~-1,dy=-9999,z=~9999,dz=-19999,type=worldedit:pos1] ~~~ summon worldedit:selection_box ~~~ x "we_stage1"
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~-1,dy=-9999,z=~9999,dz=-19999,type=worldedit:pos1] ~~~ tp ~~1~
 
 
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~1,dy=9999,z=~9999,dz=-19999,type=worldedit:pos1] ~~~ summon worldedit:selection_box ~~~ x "we_stage1"
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~1,dy=9999,z=~9999,dz=-19999,type=worldedit:pos1] ~~~ tp ~~-1~
 
#stage 2
 
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~,dy=0,z=~1,dz=9999,type=worldedit:pos1] ~~~ summon worldedit:selection_box ~~~ x "we_stage2"
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~,dy=0,z=~1,dz=9999,type=worldedit:pos1] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ summon worldedit:selection_box ~~~ x "we_stage2"
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~,dy=0,z=~1,dz=9999,type=worldedit:pos1] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ tp ~~~-1
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~,dy=0,z=~1,dz=9999,type=worldedit:pos1] ~~~ tp ~~~-1
 
 
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~,dy=0,z=~-1,dz=-9999,type=worldedit:pos1] ~~~ summon worldedit:selection_box ~~~ x "we_stage2"
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~,dy=0,z=~-1,dz=-9999,type=worldedit:pos1] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ summon worldedit:selection_box ~~~ x "we_stage2"
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~,dy=0,z=~-1,dz=-9999,type=worldedit:pos1] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ tp ~~~1
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~9999,dx=-19999,y=~,dy=0,z=~-1,dz=-9999,type=worldedit:pos1] ~~~ tp ~~~1
 
#stage 3
 
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=1}] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=1}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=1}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=2}] ~~~ detect ~~~ air -1 structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=2}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ detect ~~~ air -1 structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=2}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box] ~~~ detect ~~~ air -1 structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3}] ~~~ detect ~~~ air -1 tag @s add we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ detect ~~~ air -1 tag @s add we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box] ~~~ detect ~~~ air -1 tag @s add we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3},tag=!we_air] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box,tag=!we_air] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box,tag=!we_air] ~~~ structure load we_selection ~~~
tag @e remove we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ tp ~1~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box] ~~~ tp ~1~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~-1,dx=-9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1] ~~~ tp ~1~~
 
 
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=1}] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=1}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=1}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=2}] ~~~ detect ~~~ air -1 structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=2}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ detect ~~~ air -1 structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=2}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box] ~~~ detect ~~~ air -1 structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3}] ~~~ detect ~~~ air -1 tag @s add we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ detect ~~~ air -1 tag @s add we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box] ~~~ detect ~~~ air -1 tag @s add we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3},tag=!we_air] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box,tag=!we_air] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box,tag=!we_air] ~~~ structure load we_selection ~~~
tag @e remove we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ tp ~-1~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box] ~~~ tp ~-1~~
execute @e[type=worldedit:pos2] ~~~ execute @e[x=~1,dx=9999,y=~,dy=0,z=~,dz=0,type=worldedit:pos1] ~~~ tp ~-1~~
 
#stage 4
 
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=1}] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=1}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=1}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=2}] ~~~ detect ~~~ air -1 structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=2}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ detect ~~~ air -1 structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=2}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box] ~~~ detect ~~~ air -1 structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=3}] ~~~ detect ~~~ air -1 tag @s add we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box] ~~~ detect ~~~ air -1 tag @s add we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box] ~~~ detect ~~~ air -1 tag @s add we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=3},tag=!we_air] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage1",type=worldedit:selection_box,tag=!we_air] ~~~ structure load we_selection ~~~
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0,scores={we_mask_mode=3}] ~~~ execute @e[name="we_stage2",type=worldedit:selection_box,tag=!we_air] ~~~ structure load we_selection ~~~
tag @e remove we_air
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0] ~~~ tag @e[name="we_stage1",type=worldedit:selection_box] add we_dead
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0] ~~~ tag @e[name="we_stage2",type=worldedit:selection_box] add we_dead
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0] ~~~ tag @e[type=worldedit:pos2] add we_dead
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,x=~,dx=0,y=~,dy=0,z=~,dz=0] ~~~ tag @s add we_dead
 
execute @e[type=worldedit:pos2] ~~~ execute @e[type=worldedit:pos1,tag=!we_dead] ~~~ function we/high-end/fills/fill-yz