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?

  • It works for me. BTW, shorter version: execute at @s unless block ~ ~-1 ~ air run setblock ~ ~-1 ~ gold_block – Fabian Röling Aug 12 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 Aug 13 at 7:55
  • @Plagiatus Almost. I meant at @a instead of at @s. as is not needed. – Fabian Röling Aug 13 at 11:00

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

New contributor
minecraft and anime lover is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.