I have been running into roadblocks at the moment with the use of executing if and unless statements, not only that but also in using tags.

for example here I have a command block running through a few tags and I need it to cover 2 tags "crafting_block2" and "crafting_block1" except it treats it more like a & operator if I use it like below.

/execute as @e[type=minecraft:armor_stand,tag=crafting_block] align xyz positioned ~0.5 ~0 ~0.5 unless entity @e[type=minecraft:villager,tag=crafting_block2,tag=crafting_block1] at @s run kill @s

So it would only execute if the armor stand has both of the tags, but I want it to execute when it has either of the tags.

I know I could apply another tag from the start to cover it all but is there a way to do this without the additional tag (and without the use of scoreboards). if there is a OR operator or something like that, that would be nice.

As well on top of that, I also want to know about a similar thing

execute as @e[type=minecraft:armor_stand,tag=Landmine] at @s align xyz positioned ~0.5 ~ ~0.5 if block ~ ~ ~ air run tp @s ~ ~-1 ~

for example here, I couldn't quite get it to work on both cave air and normal air. Like as I said above if I tried to put another if statement in it treats it as if there if an AND operator and would only work if both are true (which is impossible in this case). In the end, I had to duplicate the entire command to compensate for this which is ridiculous.

3 Answers 3


Duplicating commands is a common thing, because there is no "OR" in commands.

In your first case you might be able to do something like "as @e[type=villager] unless entity @s[tag=block1] unless entity @s[tag=block2]" or other fancy tricks, but if that doesn't work in your case, then yes, you might need to use another tag. You can also do very fancy things, like custom predicates (in 1.15), but that's not worth it for such a small example.

Another thing that is also called "tag" (not to be confused with NBT tags, the tags that were formerly a part of the scoreboard command, name tags, the "tag" NBT tag of items or the German word for "day") can help for your second case. If you create a block tag (archive) with the name air and then check for "#air" instead of "air", you can match all blocks in that tag at once. Don't forget the namespace if your datapacks uses a different one than minecraft.

  • What's the difference between air and #air? I don't get what is "cave air" nor "void air", how are they different from a normal air block?
    – BunnyMerz
    Commented Nov 21, 2019 at 17:14
  • 1
    "#air" is a block tag that includes all air variants, just like "#logs" is a block tag that includes oak_log, spruce_log, dark_oak_log, acacia_log, jungle_log and birch_log, so that you don't have to write the same command three or six times with each of those blocks. "cave air" gets generated instead of normal air in caves, otherwise it is identical. But if you for example replace all regular air with something, that would not work inside caves. "void air" is internally used by the game for something, but doesn't normally occur anywhere.If you set it manually, #air matches it. Commented Nov 21, 2019 at 19:08
  • Hey Fabian but one of the reasons why I posted these examples to this question is because I can't find the tag for air variants #air. Is this newly added tag in a snapshot?
    – Joe
    Commented Nov 27, 2019 at 12:25
  • That's weird, the wiki also doesn't list it. I thought I had seen it before. I'll ask around a bit. Commented Nov 27, 2019 at 13:48
  • Apparently it does not exist, that is weird. I updated my answer accordingly. Commented Nov 27, 2019 at 17:02

To check stuff in minecraft using commands, you have to use logic based on "and". When you check for stuff, everything will have to be true for it to return true. A mini class of logic: let p be a tag and q another tag. You want the command to be executed when either of those are true, or both, that's an "or", but minecraft only checks everything with "and".

p | q | or
v v v
v f v
f v v
f f f

If you invert everything (!) and change it with and, it will look like this !p | !q | and f f f f v f v f f v v v As you can see, it's exactly the opposite. if you invert and, you will end up with the same order as in or, thus making an "or" operator based on "and".


This does not work, as there is no or:

execute if @e[tag=p (or) tag=q] 

But this is equivalent to this:

execute unless @e[tag=!p,tag=!q]

It will not execute if there is no tag p and no tag q. It will execute if there is tag p or tag q.


Here is an example for Val = A or Val = B or vAl = C:

execute unless @s[val=!a, val=!B, vAl=!C] run ...

The commas (,) are the "Or's".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .