Minecraft Commands – How to Group Air Void Air and Cave Air

minecraft-commandsminecraft-java-edition

execute unless air ~ ~ ~ doesn't work when you're in the void or in a cave.

Is there something like #air that joins all air blocks together, like #wool?

Best Answer

Unfortunately, there doesn't seem to an #air tag available in vanilla Minecraft.

One possible workaround is to simply duplicate the condition:

execute unless block ~ ~ ~ minecraft:air unless block ~ ~ ~ minecraft:cave_air run <...>

Note that you do not need to explicitly test for void_air as of Minecraft 1.16, as execute unless block will always fail in the void.

In theory, it should also be possible to create a predicate in a datapack that tests for the relevant criteria.