When testing for entity in cubic areas, placing - in dx,dy,dz won't work
Exact command used:
/testfor @p[x=9988,y=56,z=10000,dx=4,dy=-2,dz=4]
Linked issues
is duplicated by 5
Comments 14
CubeTheThird but that would mean the box is not positioned correctly :/ the negatives ARE needed to properly define the area
@Conor, perhaps there is something that I am not considering, but if you are searching for players from y 56 to 2 blocks below, is that not equivalent to y 54 to 2 blocks above?
Negatives cannot be used. Start your box in the lowest corner, you can define any region without negatives.
/testfor @p[x=9988,y=56,z=10000,dx=4,dy=-2,dz=4]
can be re-written as
/testfor @p[x=9988,y=54,z=10000,dx=4,dy=2,dz=4]
as CubeTheThird showed. If you test it I'd be very surprised if it doesn't work.
The given solution only works if the command block does not move. Minecart command blocks and those from /clone will still affect the original target.
I came across this problem while building a UFO that flies using /clone to move itself, /tp to move entities and /fill to remove the old copy. I want to add a tractor beam to suck up cows below (/tp) but there is no easy way to select a 3x20x3 pillar BELOW the ship.
Ah... I see. I was thinking in terms [r=] being centered at the command block also applying to other selector terms. Nevermind then, that would be a feature request and not a bug.
replaces prison cell with fireball cannon
Comment of @unknown in MC-48402:
it's dx, dy and dz and you can not use negative values for them
Technically speaking, the negatives aren't needed as your command could be rewritten:
It is possible this may be intended.