mojira.dev
MC-79972

targeting with only y and dy doesn't work in command block

when you put this command in a command block linked to a clock

kill @e[y=-40,dy=39]

and then go between 0 and -40

nothing happens

but when the player uses the exact same command, it kills all entitys that are below 0 but above -40

Linked issues

Comments 9

Confirmed for

  • 1.8.4

Strangerwise it only happens with clocks, running this command indirect (with a setblock command) works.

This seems to happen only if the command block running this command didn't run a command before. If you run a command before (no matter if it failed or not) it will find the player.
It also seems like this happens only when you are targeting players below y=0.

Found no difference in the NBT tags of the command blocks

Strangerwise it only happens with clocks, running this command indirect (with a setblock command) works.
This seems to happen only if the command block running this command didn't run a command before. If you run a command before (no matter if it failed or not) it will find the player.
It also seems like this happens only when you are targeting players below y=0

I cannot say it works when the commandblock didn't run that cammand first, it still does nothing for me.

also "only below y=0" I tested that before with y=0,dy=255 and it did nothing, again

Are you standing exactly beneath the command block? Because when you use dx, dy or dz it default the other ones to 0

ok, so it works when right below the command block, but at no other coordenate

but I expected it to work everywhere at y=-40 until y=0 instead of just right beneath the command block

The coordinate parameters are filled in if they are missing using the coordinates of the command sender. In this case, the command sender is the command block so it uses the command block's coordinates. If you want to target every entity to kill them within a specific Y value but any X and Z, you have to turn them into command senders using /execute so the coordinates are filled in with their own:

/execute @e ~ ~ ~ kill @e[y=-40,dy=39,c=1]

I found that workaround after ~a month of searching for a better way
however this is still not the behaviour I expected when I made the command

This really is not a bug. How can you provide only part of a coordinate point and a range limiter without providing the rest of the information for that coordinate? The game needs to know where to start the search from, hence why it fills in the unspecified coordinate parameters with the sender's location. This is more of a feature request than a bug report.

And it's not as though it can be implemented without major drawbacks. For example, given the following command in a command block:

/execute @a ~ ~ ~ say @a[r=10]

With your implied suggestion implemented, /say would target all players regardless of their coordinates because the suggestion is to ignore unspecified coordinates. The 'radius' parameter becomes useless. It completely breaks all commands that target entities.

The only way to use the suggestion effectively is to know where the executing target is standing, which goes against the point of /execute. /execute was introduced in order to replace the unspecified coordinates with a sender's position, which is essentially the "fix" to your issue.

All right, I'm convinced, this can be closed as WAI

Cannot reproduce the bug described in my first comment neither, I do not know what caused it

user-f2760

(Unassigned)

Confirmed

command, command_block, dy, targeting, y-coordinate

Minecraft 1.8.4, Minecraft 1.8.7, Minecraft 1.8.8, Minecraft 15w31a, Minecraft 15w31b, ..., Minecraft 15w44b, Minecraft 15w45a, Minecraft 15w46a, Minecraft 15w47a, Minecraft 15w49a

Retrieved