I have a system set up to trigger a command block if an entity walks to that spot. However, it is setting off the trigger without an entity being there. This is the command that I'm using:

execute if entity @e positioned -86 5 82 run fill -88 4 79 -88 4 79 minecraft:redstone_block

Why is my command running even when an entity is not in that location?

  • 1
    /execute positioned does nothing if you don't use the coordinates for anything and /execute if entity @e is pretty much always true. Feb 27 '20 at 23:10

Your command is testing for an entity with the selector @e, which is any entity. This will almost always be true while you are on the world / server.

The positioned means that the command is ran from the location, so if you did /execute positioned x y z run setblock ^ ^ ^ stone then the block at x y z would be set to stone.

The correct version of this command would be:

/execute positioned x y z if entity @e[distance=..1] run fill xyz1 xyz2 block

And obviously you would replace x y z, xyz1, xyz2 and block with your own data.

  • That's actually wrong: you should instead omit the positioned subcommand and instead use the x, y, and z target selector arguments. Sep 27 at 1:12

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.