3

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 – 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
  • @Plagiatus i'm more familiar with fill rather than setblock, so i never really messed with it until recently. – EarthToAccess Aug 20 at 23:33
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! – EarthToAccess Aug 21 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 Aug 27 at 13:39
0

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

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.