[MC-12239] command block testfor command does not work with coordinate arguments Created: 17/Mar/13  Updated: 29/Dec/17  Resolved: 17/Mar/13

Status: Resolved
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 1.5
Fix Version/s: None

Type: Bug
Reporter: Evan B Assignee: Unassigned
Resolution: Works As Intended Votes: 0
Labels: command_block, comparator, coordinates, redstone
Environment:

Windows 8
Java Version 7 Update 11


Attachments: PNG File 11-1-13[2334@-5gmt]Bueller.png     PNG File 2013-03-17_13.47.57.png     PNG File 2013-03-17_13.48.03.png     PNG File 2013-03-17_13.48.06.png     PNG File 2013-03-17_13.48.09.png     PNG File 2013-03-17_13.50.08.png     PNG File 2013-03-17_13.50.13.png     PNG File 2013-03-17_13.50.52.png    
Issue Links:
Duplicate
is duplicated by MC-30435 "/testfor" Coordinate Output Always True Resolved
is duplicated by MC-34979 /testfor not working with coordinates Resolved
is duplicated by MC-38417 Location parameters not working when ... Resolved
is duplicated by MC-40797 /testfor with co-ordinates doesn't work? Resolved
is duplicated by MC-50183 Strange coordinates behavior Resolved
is duplicated by MC-51835 XYZ doesn't work with /testfor Resolved
is duplicated by MC-56021 Selector not functioning correctly wi... Resolved
is duplicated by MC-73005 command testfor don't work when you p... Resolved
is duplicated by MC-73256 command testfor dont work with coordi... Resolved
Confirmation Status: Unconfirmed
Game Mode: Creative

 Description   

When I put "testfor x=7,y=5,z=32" in a command block and hooked it up to a redstone clock so that it would update itself and put a redstone comparitor in front of it...

What I expected to happen was...:
-When I was at coordinates "7 5 32", the comparitor would turn on, powering the redstone in front of it
-When I was not at said coordinates, the comparitor would turn off

What actually happened was...:
As soon as the command was entered in the command block, the comparitor turned on, and refused to turn off no matter where i was (including those coordinates)

Steps to Reproduce:
1. Place a command block
2. Place a redstone comparitor facing out from the command block
3. In the command block, type the following: "testfor @p[x=<your x coordinate>,y=<your y coordinate,z=<your z coordinate>]"
4. Place a redstone repeater facing out from the comparitor
5. Place a redstone lamp so that it gets input from the redstone repeater
6. Hook the command block up to a redstone clock (google how to do this if you don't know)

All other commands and testfor arguments work perfectly for me.

Edit:
At the input of a commenter, I included a maximum search radius argument ("r=<radius>"). Now the command block acts as if the search radius argument was the only argument, turning on when I am in radius and off when I am out of radius, regardless of coordinates.



 Comments   
Comment by KingSupernova [ 17/Mar/15 ]

To all you people saying this is still an issue:

No it's not. The radius argument defaults to infinity if you don't input it. So if you type "/testfor @a[x=0,y=0,z=0]", it will look for all players within a radius of infinity of 0, 0, 0, and it will obviously find all players in the world. If you want to limit the search radius, input a radius argument. In the future, please actually check the correct syntax for commands before posting a bug report.

Comment by Ethan L! [ 22/Jan/15 ]

Yup, I'm having the same basic issue. Mojang's gotta' fix this.

Comment by Steven Valenski [ 02/Nov/13 ]

mine was forced onto this and marked as resolved >_> so I'll probably just make a new one

Edit: new ticket MC-38817

Comment by Ferdinand B. [ 02/Nov/13 ]

I suggest you to change the title into something similar to "[Command Block] testfor, tell, tellraw and tp don't accept coordinate-@ arguments", but that's only my thought, so if you think the existing title suits this topic better, go leave it.

I sure notice this as I receive email-notifications about it, so I thought I re-confirm the issue with 1.7.2
And there we are, with a (in my thoughts) really important bug that should be fixed, because it really makes adventure-maps suffer.

Comment by Steven Valenski [ 02/Nov/13 ]

thank you Ferdinand B., I thought no one was going to notice this just because it's already been written off

Comment by Ferdinand B. [ 02/Nov/13 ]

confirming that commands /tp and /tell do NOT work with @ statements that make use of the x,y,z or r arguments in Minecraft 1.7.2
Other arguments work fine though.

Examples:

  • /tell @p[score_lolz=1] Whisper
    works
  • /tell @p[x=102,y=65,z=-364] Whisper
    doesn't work (claims to not be able to find player)
Comment by Steven Valenski [ 02/Nov/13 ]

A screenshot of my location, the command used and the return I get when attempting to use it.

Comment by Steven Valenski [ 02/Nov/13 ]

can someone please take the time to confirm this instead of just writing it off as someone else' syntax errors. This is NOT working as intended.

Comment by Steven Valenski [ 31/Oct/13 ]

please update to include affects versions 1.7.2 and mark it as re-opened

Comment by Steven Valenski [ 31/Oct/13 ]

tested a couple more commands /tell and /testfor are also not responding to location arguments correctly

Comment by Steven Valenski [ 31/Oct/13 ]

it appears I need to correct myself again. it seems that location restricting arguments are simply not working with the /tp command, whether or not it is executed via a command block. Though it is working with other commands like /give and /scoreboard

Comment by Steven Valenski [ 30/Oct/13 ]

Also in the same right I have no idea why my new report was referred to here considering this was for 1.5 and I was reporting for 1.7.2

Comment by Steven Valenski [ 30/Oct/13 ]

can someone update this to affects 1.7.2?

Comment by Steven Valenski [ 30/Oct/13 ]

New development: I moved the command blocks to a new location, didn't even change the commands in the slightest and now they work.

Edit: the TP command block still didn't work

Comment by Steven Valenski [ 30/Oct/13 ]

Just realized I have another couple command blocks with similar code but they do work.....
effect @a[60,69,4,1,score_MobKills_min=500] 5 3600 3
scoreboard players remove @a[60,69,4,1,score_MobKills_min=500] MobKills 500
not sure why one works and the other doesn't

Comment by Steven Valenski [ 30/Oct/13 ]

I have had similar issues as well but mine was looking for a person to TP for example
tp @a[70,64,-15,1] 60.5 68 -2.5
using this as my command it pulled everyone in my game not just everyone in that location, further testing also showed this is not the case when a specific player is called, for example
tp Kurai_ookami[70,64,-15,1] 60.5 68 -2.5
only work while within the radius, so it seems @p, @r, and @a are not simply being treated as a player name as they behave differently. Also playing around with different input structures
tp @a[x=70,y=64,z=-15,r=1] 60.5 68 -2.5
tp @a[x=70,y=64,z=-15,r=1,rm=0] 60.5 68 -2.5
tp @a[x=70,y=64,z=-15] 60.5 68 -2.5
has shown that none of the formats for writing arguments work with the @p, @r and @a calls but do work when referring to a specific player. Including the 3rd which does not list a radius (defaulting to both minimum and maximum radius being 0 A.K.A. the exact location called and nothing more) showing that a radius is NOT required.

Edit: to be more clear this was actually tested with an effect command, /tp still does not work

Comment by Ferdinand B. [ 05/May/13 ]

also, you didn't really give us a real clue what you put into the command block.

Once you said testfor x=<number> y=<number> z=<number>
and once you said testfor @px=<number>,y=<number>,z=<number> and in your pic you said @p[x=<number>,y=<number>,z=<number>]

The way it works is this:

testfor <playername>
The @-Notations are treated as playernames

If you do an @-notation with arguments [x,y,z] then it will search from that location but the radius will still be infinite.
So @p[3,4,5] will still be on as long as at least one player is online (he is the nearest to 3,4,5)

In your case, I would either do @p[x,y,z,r], @a[x,y,z,r] or @r[x,y,z,r] to get the disired effect (only triggering if you are in a certain area)

Example: testfor @a[x=27,y=65,z=-1226,r=3]
Will test for a player within 3 blocks spherical radius of x=27, y=65 and z=-1226

Comment by Tails [ 17/Mar/13 ]

Search radius is always required when using specific coordinates.

Comment by Tails [ 17/Mar/13 ]

Please do not mark issues as private, unless your bug report is a security issue containing information that may compromise your server/client.

Comment by Evan B [ 17/Mar/13 ]

Is that necessary? And why is that necessary if I specify the coordinates?

Comment by Tails [ 17/Mar/13 ]

You haven't provided a search radius.

Generated at Sun Jan 12 12:30:16 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.