mojira.dev
MC-39099

/testfor in command blocks doesn't target the appropriate location

When using testfor to target a player via command blocks the block it ended up targeting was next to the one I had set.
I used 3 slight variations to test this
testfor @p[-724,53,-115,1]
testfor @p[-724,53,-115,2]
testfor @p[-724,53,-115,3]
the results of where I had to stand to produce successful output are displayed in the attached image

to reproduce
1:Select and mark a location to test. (if possible use X and Z coordinates that are negative, it may somehow be related to the problem)
2: Make a command block connected to a pulse signal so that it will check frequently wether or not you are in the right area.
3:Connect a comparator to the command block to transmit a redstone signal, from the command block, into some sort of signal for when you are in the right area. (I used a redstone lamp)
4:Turn on your redstone pulse and mark the areas that trigger a successful execution of the testfor command
5:this is where I saw that all of the different radius settings were all off by one block to the south-east. (my results are shown in the attached screen capture)

Linked issues

Attachments

Comments 6

would anyone like to take a look at this for me?

I'm not sure I understand. I have a working testfor and the radius isn't affected.

the radius isn't what's the problem it's that when using testfor and targeting a negative coordinate the location it actually centers on is off by one. For example if you tell it to check for -15, 75, -15 it instead centers on -14 75 -14
or other such as
-15, 75, 15 -> -14, 75, 15
15, 75, -15 -> 15, 75, -14
15, 75, 15 -> 15, 75, 15
basically what I'm say is when using testfor negative coordinates are off by one

it's a little hard to read but in the picture I posted, the purple block on the ground represents the coordinates I used, where the different shades of green represent what was actually targeted at different radius. show that when x and z are negative it actually tests one block diagonally closer to x=0, z=0

You can easily duplicate this issue. If you do something like this:

/testforblock 89.40 70.00 -154.17 air

You get:

Successfully found the block at 89,70,-155.

Notice that the Z is incorrect, it should be 154.

Duplicate of MC-4794, read all the comments there for an explanation.

Steven Valenski

(Unassigned)

Unconfirmed

command, command_block, coordinates, testfor

Minecraft 1.7.2

Retrieved