The /locate command is giving out coordinates for structures that are not the closest one to the player (as the command should do). It is based on the player moving to certain locations and distances around structures.
Steps to recreate (the way I discovered it):
1. Load a world using the seed 3693371748873689916 in 21w42a. (It has a Jungle Temple within view distance.)
2. Move more than 80-100 blocks to the Northwest of the Jungle Temple and run /locate jungle_pyramid (It should give you the location of one a few hundred blocks away.)
3. Move closer to the Jungle Temple (while still Northwest of it) and run /locate jungle_pyramid again. (Eventually it should give you the coordinates of the one you're looking at.)
It also occurs with ones further away as well. If you stand approximately in the spot that the screenshot further from the Jungle Temple is, you'll get one Jungle Temple that's farther than the visible one. Move about 10-20 blocks or so to the left, and you'll get one even further away.
This bug doesn't seem to affect every structure, and the distance to trigger it is different as well. Jungle Temples, Villages, and Ruined Portals trigger at ~66-80 blocks, while ones like Shipwrecks trigger at ~30 blocks. On top of that, at least with Shipwrecks, if you teleport to the coordinates and make a pillar on that exact spot, the bug always occurs if you are North of that pillar. Go South of it and it works until you get a certain distance away, though it doesn't work in all South directions.
Linked issues
Attachments
Comments


@j_p_smith I always do use the search function first before making a post, but rarely does it actually show any relevant posts, leading me to ultimately create a duplicate.
Thank you for your report!
We're actually already tracking this issue in MC-138887, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any additional information to the main ticket it would be appreciated.
Please be sure to use the search feature before creating a ticket to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 🛠 Community Support – 📧 Mojang Support – ✍️ Feedback and Suggestions – 💬 Mojira Discord