I'm attempting to make a "midas touch"-eqsue system where the block underneath the player's feet will turn to a gold block. However, I found that'll be troublesome if I don't detect for air blocks, since that will basically allow for the player to jump and walk in mid-air.

My command is currently this;
execute as @a at @s unless block ~ ~-1 ~ air run fill ~ ~-1 ~ ~ ~-1 ~ gold_block

Oddly, it's not looking for any (or simply isn't finding) any air blocks at all. It will detect other blocks and refuse to run there, eg. I replaced "air" with "diamond_block" and it worked in not turning diamond blocks, but it refuses to work with air.

Is this a known bug, or am I missing something?

  • 1
    It works for me. BTW, shorter version: execute at @s unless block ~ ~-1 ~ air run setblock ~ ~-1 ~ gold_block Commented Aug 12, 2019 at 20:59
  • not sure why you're using fill instead of setblock, but that command should work fine. are you in vanilla or on a third party server? and @FabianRöling, that one won't work from a commandblock, you'll need the as @a first.
    – Plagiatus
    Commented Aug 13, 2019 at 7:55
  • @Plagiatus Almost. I meant at @a instead of at @s. as is not needed. Commented Aug 13, 2019 at 11:00
  • @Plagiatus i'm more familiar with fill rather than setblock, so i never really messed with it until recently.
    – xTerrene
    Commented Aug 20, 2019 at 23:33

2 Answers 2


You probably have this problem, because you test the command in a cave. Minecraft has air and cave air, they are considered to be two different blocks.

To solve this problem you can use this command:

/execute at @a unless block ~ ~-1 ~ minecraft:air unless block ~ ~-1 ~ minecraft:cave_air run setblock ~ ~-1 ~ minecraft:gold_block
  • I... was, in fact, testing it in a cave, and I didn't even know that existed. Thanks!
    – xTerrene
    Commented Aug 21, 2019 at 0:09
  • to make this a little better, you can add a blocktag with all the air in the game (there is air, cave air and void air afaik). See minecraft.gamepedia.com/Tag for more info on tags.
    – Plagiatus
    Commented Aug 27, 2019 at 13:39

try using execute @a ~~~ detect ~~-1~ frag 0 setblock ~~-1~ gold_block

and this is just for example replace frag with the block you want the player to step on

You must log in to answer this question.

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