I have a server and would like to now if it is possible to print the X,Y,Z coordinates of a player, and how to do this.
-
5Possible duplicate of Print XYZ of nearest Villager (or other entity) – pppery Jul 31 '20 at 13:40
-
@ppery while that is definitely helpful; that post does not state how to refer to a player as an entity. I don't see code like '@e[type=player', so if the semantics are unknown to the person seeing that answer, they can't figure out how to adapt it to work for players instead of a villager). It solves 90% of this problem, but not 100%, not an exact duplicate. Maybe you could include the semantics in an answer here and link to that other answer for the remainder of the code? Both for nearest and a specific player? – aphid Aug 1 '20 at 20:00
-
@aphid I'd flag the hypothetical question "how do I take this command that works with villagers and make it work with players instead' as a duplicate of What are the basics of commands in Minecraft Java Edition, so there's no scope for an answer here and the question should be closed regardless. – pppery Aug 1 '20 at 20:20
-
Nice, now we can close it, as a random person coming from google should be able to find an answer using both links. – aphid Aug 1 '20 at 20:38
/execute as PLAYER/TARGET run execute at @s run tp @s ~ ~ ~
this teleports a target to its current location. I tested it on a bunch of chickens so I should work.
The server console should be able to see the feedback from this command, thus showing the coordinates of a player/mob.
Change PLAYER/TARGET to your desired target. @a will select all players
be careful tho because and error in this command could tp everyone to the world spawn