1

I am trying to use the /execute and detect air below the player and set the block to a barrier block and the destroy it one second later. in doing this I am trying to make a double jump mechanism but a the moment the commands are in separate blocks using comparators and repeaters this is fine on single player but not multiplayer friendly. I did some research and I got this:

/execute @e[type=Player] ~ ~ ~ detect ~ ~-2 ~ air 1 fill ~-2 ~-1 ~-2 ~1 ~-1 ~1 barrier destroy 0

But, this doesn't work and it comes up with

[11:52:19] Failed to execute 'detect' as mr_assley19

If anyone could come up with any alternatives or how to fix the command that I've tried, then that would be great!

3

To fix the command:

  • @e[type=Player] can just be @a
  • There is no air with a data value of 1, so the detect will never succeed; it should be 0
  • The data value in /fill should come before the old block handling mode

So your command should be:

execute @a ~ ~ ~ detect ~ ~-2 ~ air 0 fill ~-2 ~-1 ~-2 ~1 ~-1 ~1 barrier 0 destroy

I'm not sure if this really does what you want it to though. There is no way to execute two separate commands in a command block, nor is there any way to have a delay in a single block.

  • Nicely explained +1 – Ben Apr 2 '15 at 2:37
  • 1
    @a will select dead players, while @e[type=Player] will select only living ones. There is a difference. – rustphoenix Jan 15 '16 at 16:25
  • 1
    @sharpturn Not saying there isn't a difference, but that @a will work for this. In fact, it'll be better if barriers aren't left around from when people die. – SirBenet Jan 15 '16 at 17:20
1

Detect syntax:

    /detect <x1> <y1> <z1> <x2> <y2> <z2> <TileName> <dataValue>

The detect command needs block datavalue as well as the ID for the block. The only valid metadata for air is 0. 1 will cause the detect to always return false because minecraft cannot find air with datavalue 1.

Fill syntax:

    /fill <x1> <y1> <z1> <x2> <y2> <z2> <TileName> [dataValue] [oldBlockHandling] [dataTag]

For the fill command, you just mixed up the dataValue and oldBlockHandling.

Final command should be:

    /execute @e[type=Player] ~ ~ ~ detect ~ ~-2 ~ air 0 fill ~-2 ~-1 ~-2 ~1 ~-1 ~1 barrier 0 destroy
  • these don't quite work because as soon as you jump it continually creates and the destroys the block leaving you in the air – user107110 Apr 2 '15 at 0:01
0

Scoreboard Setup:

/scoreboard objectives add LivingTime dummy

Inside of a fast clock (20 times per second clock):

/execute @a ~ ~ ~ detect ~ ~-2 ~ air 0 summon ArmorStand ~ ~ ~ {CustomName:"Target", Marker:1, Invisible:1}
/execute @e[type=ArmorStand,name=Target] fill ~-2 ~-1 ~-2 ~1 ~-1 ~1 barrier 0 destroy
/scoreboard players add @e[type=ArmorStand,name=Target] LivingTime 1
/execute @e[type=ArmorStand,name=Target,score_LivingTime_min=20] fill ~-2 ~-1 ~-2 ~1 ~-1 ~1 air 0 destroy
/kill @e[type=ArmorStand,name=Target,score_LivingTime_min=20]

The first command (ignoring the setup command) summons an armor stand with a custom name of Target at every player who has a air block 2 blocks below them. The next command fills the area 2 blocks below every armor stand that has a custom name of Target. In the third command, the LivingTime for every armor stand is incremented and when LivingTime is at least 20, the area 2 blocks below is replaced by air and the armor stand is killed, removing its LivingTime.

  • this doesn't work can you please expand on this – user107110 Apr 2 '15 at 0:35
  • this dosnt work ill ask a question about it because it should – user107110 Apr 2 '15 at 3:08
  • 1
    It sounds like this needs a bit more explanation, as the asker isn't quite understanding what it is you're telling him. – Frank Apr 2 '15 at 3:44
  • 1
    It was simply missing some quotes, I edited it and it should work now. – rustphoenix Jan 15 '16 at 16:33
  • @user107110 This was an attempt to answer your question, however the original answer is extremely hard to understand and had command mistakes. Also, this uses a lot of command blocks as far as I can tell. – User that is not a user Oct 9 '18 at 23:46

Your Answer

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