Filling every air block above a specific block in a specific area

Using offset masks is the correct way to do this with WorldEdit.

If you want to replace every air block above an End Stone with White Stained Glass, use //replace ">end_stone air" white_stained_glass.
However, do note that Minecraft now has 3 types of air blocks, so !#existing is often more useful, as that matches any location that doesn't contain a block (e.g. it only matches air types).

Source: https://worldedit.enginehub.org/en/latest/usage/general/masks/#offset-mask


There is no simple command to do this, at least in Vanilla. But you could use a ridiculously complicated system of commands to reach the same effect. And who doesn't like that?

First, spawn an armour stand at the lowest X and Z coordinate of your area, high in the air:

/summon armor_stand <x> 255 <z> {NoAI:1,NoGravity:1,Tags:["xMover"]}

Then run these two commands for at least as many times as the area is long in the X direction (more doesn't matter much, except for performance, so I recommend just leaving a repeating command chain on for a few seconds):

execute at @e[tag=xMover] run summon armor_stand ~ ~ ~ {NoAI:1,NoGravity:1,Tags:["zMover"]}
execute as @e[tag=xMover] at @s run tp @s ~1 ~ ~

This should give you a long line of hovering armour stands.

Now you let this line spawn lots of non-hovering armour stands. Those will fall down and land on the top block of the column they're in.

Warning: Water, lava, signs and other blocks that armour stands can fall through might mess with this. Also end crystals like placing fire below themselves in many situations, potentially overwriting your slabs.
And, of course, this creates a TON of lag. You should better stay in a position where you can turn the lever off again at any point and just look at the coordinates in chat (command output) to determine when to deactivate it, because even entering commands lags a lot if you full your entire End island this way.

execute at @e[tag=zMover] run summon armor_stand ~ ~ ~ {NoAI:1,Tags:["placeHere"]}
execute as @e[tag=zMover] at @s run tp @s ~ ~ ~1

Then you wait a bit until all armour stands have fallen and run these two commands (if you don't trust that all chunks are loaded, you can also run these together in a chain multiple times):

execute at @e[tag=placeHere] run setblock ~ ~ ~ stone_slab
kill @e[tag=placeHere]

And finally you can also kill the other armour stands:

/kill @e[tag=xMover]
/kill @e[tag=zMover]

Another warning: This only works for the top layer of each column. In spots where there is e.g. End stone above three blocks of air above more End stone, then it still leaves those spots uncovered. A ridiculous solution would be to run this entire system on every single Y layer.


Alternatively you could use spawning to your advantage. Simply use these three commands in a repeating and a chain command block:

execute at @e[type=enderman] run setblock ~ ~ ~ stone_slab
kill @e[type=enderman]
kill @e[type=item,nbt={Item:{id:"minecraft:ender_pearl"}}]

Then wait for an hour or so and most of the End should be slabbed, at least from 32 to 128 blocks around you. Move around occasionally if you also want the rest to get slabbed, but usually the End has a radius of 128 and no caves very close to the center, so if you just stand in the middle, it should leave out very few spots.