3

If I do:

/testfor @p[x=,y=,z=,r=]

It says:

The entity UUID is in an invalid format.

0

5 Answers 5

8

You're scanning for the nearest player, your should scan for all the players.

Solution

/testfor @a[x=X,y=Y,z=Z,r=R]

Where:

  • X the x location
  • Y the y location
  • Z the z location
  • R the radius

For example:

/testfor @a[x=64,y=10,z=64,r=5]

(Search for players on coordinates 64,64 at height 10, with a radius of 5 blocks)

Variables

Specify the location:

  • @p nearest player
  • @r random player
  • @a all players
  • @e all entities

Specify the values:

  • x, y, z coordinate
  • r, rm radius (max, min)
  • m game mode
  • c count
  • l, lm experience level (max, min)
  • score_name max score
  • score_name_min min score
  • team team name
  • name entity name
  • dx, dy, dz volume dimensions
  • rx, rxm vertical rotation (max, min)
  • ry, rym horizontal rotation (max, min)
  • type entity type

Examples:

To test if Alice is online:

testfor Alice

To count the number of players in survival mode within a 3-block radius of (0,64,0):

testfor @a[0,64,0,3,m=0]

To count the number of players currently flying:

testfor @a {abilities:{flying:1b}}

To count the number of zombies within a 20-block radius of (0,64,0):

testfor @e[0,64,0,20,type=Zombie]

Source

9
  • This does not really answer the question. He wants to detect himself.
    – 54D
    Dec 29, 2014 at 11:56
  • His title states that he wants to test for a player at specific coordinates, I cannot find where he states that he wants to find himself.
    – Inferno IV
    Dec 29, 2014 at 12:01
  • Isn't he himself a player?
    – 54D
    Dec 29, 2014 at 12:01
  • Correct, He is a player as well. The solution I propose (which scans all players) will include him.
    – Inferno IV
    Dec 29, 2014 at 12:04
  • 1
    @ArceusMaster0493 If the original intention is scanning himself at coordinates (so checking if he's near coordinates), the command should be: testfor @a[64,64,10,5,name=playername]. I'm not twisting his original intention, I'm just answering his question which states: How do I test for a player at specific coordinates?, which not specifies himself.
    – Inferno IV
    Dec 29, 2014 at 12:17
7

In newer versions of minecraft you can use something like this:

/execute as @a[x=100,y=100,z=100,dx=0,dy=0,dz=0] at @s run <command>

You need to specify delta values for this to work. The coordinates defined with x y z are one corner of the specified area, the delta values dx dy dz define how many blocks the second corner is away from the first corner.

You can also use this command:

/execute positioned 100 100 100 as @a[distance=..1] at @s run <command>

This will execute your command as all players who are within a 1 block radius from the coordinates 100 100 100.

3
  • I tried the first command in chat, it worked fine. However, when I tried the exact same command in a command block, nothing happened. Strange. Aug 24, 2019 at 1:00
  • @Diriector_Doc what exact command did you try to run? The first command should in most cases work the same in a command block as in chat.
    – user232393
    Aug 24, 2019 at 10:06
  • Never mind. I got it to work. Even though it was a repeating command block that was always active, I needed to provide a block update. Then it worked fine. Aug 24, 2019 at 19:06
0

I've noticed that the invalid UUID doesn't always mean that the format is wrong, as I've gotten the error a lot when the format was correct, but no entity was detected. Make sure you are in the area you've specified, and then retry your command.

0

You would use the testfor command like so:

/testfor @a[x=-682,y=4,z=-188,dx=0]
-4

You put @p[x,y,z,r] this considers the whole section as the identification of the player try @p [x,y,z,r].

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .