mojira.dev
MCPE-45526

/locate command doesn't locate nearest structure

The /locate command doesn't actually locate the nearest object to you.

Example 1: nearest stronghold not found

Steps to reproduce:

  1. Use the seed picker to generate "Coastal Village" in creative mode. You will spawn at 960,4.

  2. From that location, the /locate stronghold command says the nearest stronghold is at 578,882 – about 950 blocks directly south-southwest.

  3. However, there is another stronghold at 1460,546 – only 740 blocks southeast.

Update 3 May 2019: Additional steps:

  1. Teleport to the nearer stronghold at 1460,546, or near to it.

  2. /locate stronghold

  3. The /locate command still returns the stronghold at 578,882, even though you're right on top of a different one.

The stronghold found by /locate is clearly farther away. It doesn't matter if you're directly on top of the one "invisible" to /locate, or if you move a short distance away from that spot.

Example 2: nearest monument not found

Steps to reproduce:

  1. Use the seed picker to generate "Ocean Monument Ahead" in creative mode.

  2. From the spawn point, the /locate monument command shows the nearest monument at -456,152 – over 850 blocks away

  3. Teleport to the actual nearest monument, or near to it, at 280,120

  4. Try /locate monument again. Even if you are directly over the monument at 280,120 (or near that spot), /locate still says the nearest one is at -456,152.

  5. There's another nearby ocean monument directly north of the one you're on top of, at 312,-249. This one also isn't found. The /locate command still favors the far one, even though two other monuments are closer to you.


Is the command using taxicab distance rather than Euclidean distance? If so, that seems odd, because the whole point of /locate is to find the nearest structures. (Struck out, verified Euclidean distance is used, but /locate is failing to find a nearer structure even when I'm right over it; see comment below.)

This is possibly related to MC-138887 reported for Java Edition.

Related issues

Comments

migrated

I'll add, it would be nice if there were a /locate option that listed all structures within some fixed radius, like 500 blocks radius.

migrated

I believe what you are trying to say is that the /locate command isn't directly on the structure because I have tested for this and the structure is there, however it is noticeably a little bit off from the actual structure.

migrated

No, I'm trying to say that /locate doesn't locate the nearest structure, and the error is way off, far more than you would expect if the location were "a little bit off." In the example in my description, /locate identified a stronghold 950 blocks away as nearest, when the actual nearest stronghold is a completely different one 740 blocks away in a different direction. If I plot the end portal for each stronghold on a map, it's clear and obvious which one is nearer.

I'm speculating that this error may be due to the way distance is calculated, knowing that taxicab distance will always result in longer distances than direct-bearing distance, especially for intercardinal bearings.

In the example I gave, the stronghold identified by /locate is almost directly south, while the actual nearest one is southeast (-45 degrees bearing).  An object at 45 degrees bearing will measure 1.4 times farther away than its true distance, if taxicab distance measuring is used.

migrated

It seems you are right. I guess it just happens to be by chance it was close by. By attempting more times, there have been more occasions where structures have been located more than 135 blocks from the given location. I'll look into the code from the game to try to pinpoint this error.

migrated

Euwill, I apologize for any confusion. I'm not saying that the location identified is incorrect, I'm saying that there are cases when /locate identifies one structure as nearest while completely missing another structure that is nearer.

I went back and checked the coordinates in my description. Given a search position at the spawn coordinates 960,4:

  • The stronghold identified by /locate at 578,882 is the correct location. It corresponds to the location of the village well above it, and is accessible by digging down from that well. The end portal is actually nearby in that stronghold, but not at that location (I had thought strongholds were located by the end portal, but apparently it's the top of the spiral staircase).

  • The other, nearer stronghold I found at 1460,546 is closer. I've updated the coordinates in the description. Digging straight down the well doesn't get you there; the top of the spiral staircase is actually 7 blocks east of the well.

Now, here's the new weird thing: This nearer stronghold isn't found by /locate at all, even when I'm right over it!

Update: I have verified by experimenting with two locatable strongholds (at 578,882 and -286, -702) that /locate is actually calculating distances correctly, using Euclidean distance instead of taxicab distance. The bug reported here, then, is that /locate simply cannot find one nearby stronghold even when you're right on top of it. I don't know whether this is an isolated anomaly or a systemic problem with /locate.

migrated

Updated description with a second example of /locate failing to find two nearer ocean monuments.

Auldrick

Confirmed in 1.11.4 using Windows 10. The steps to reproduce given in the description are correct.

MCPE-34355 reported a similar bug, but was retracted by the reporter who said that the command worked correctly when you were not above the ocean monument. That is not true for this report; moving some distance away, it still locates the farther target.

migrated

That is correct. It doesn't matter if you're directly over the structure. If /locate doesn't find it, then /locate never finds it, no matter where you are.

[Mojang] Mega_Spud (Jay)

Resolving issues that were marked as fixed in the 1.15 and 1.16 Betas, now that 1.16.0 is being released.

migrated

As the reporter, I have verified that the steps outlined in the description no longer reproduce the issue. This ticket can be closed.

migrated

(Unassigned)

221375

Confirmed

Windows

Windows 10

command, distance, location, nearest

1.11.1, 1.11.4, 1.16.0

1.16.0.51 Beta, 1.16.0

Retrieved