PT-BR EN ES
Channel Icon

Crazy Ozz

Official Channel Website

Command Block

How to See a Mob or Player Coordinates in Minecraft

Minecraft Java Edition 1.21+ and 26+ – Show Entity Coordinates (X, Y, Z) with Command Blocks

Want to know the exact location of a player or mob in Minecraft? In this tutorial you will learn how to display X, Y and Z coordinates of any entity using scoreboard, tellraw, and command blocks. This method works in Minecraft Java Edition 1.21+ and 26+ and is perfect for adventure maps, RPG systems, minigames, and tracking mechanics.

Step 1: Let's start by creating 3 scoreboards to store each coordinate (X, Y, and Z)

scoreboard objectives add entityPosX dummy

scoreboard objectives add entityPosY dummy

scoreboard objectives add entityPosZ dummy

Tip: place these commands in command blocks lined up in the same direction and use a button

First: Impulse command block + button on it

Second and Third: Chain command blocks and enable Always Active

Step 2: To get the player's or mob's position, we will use the commands below. There is one command for each coordinate (X, Y, and Z)

execute store result score @p entityPosX run data get entity @s Pos[0] 1

execute store result score @p entityPosY run data get entity @s Pos[1] 1

execute store result score @p entityPosZ run data get entity @s Pos[2] 1

Do the same command block setup from the tip in step 1

Just set the Impulse command block to Repeat and Always Active to keep updating the coordinates

You can replace @p with @e and choose the mob you want, for example: @e[type=minecraft:zombie,limit=1]

You need limit=1 because we can only get the coordinates of 1 mob at a time

Because of that, it's a good idea to apply a tag to this mob

Want cheap and lag-free Minecraft hosting?

I recommend Sparked Host: affordable plans, great performance, easy panel and fast support.

🚀 Start your Minecraft Server

Step 3: The command below will be responsible for showing the mob's or player's coordinates in the chat

tellraw @p [{"text":"Entity coordinates: ","color":"red"},"\n",{"text":"X: ","color":"yellow","bold":true},{"score":{"name":"@p","objective":"entityPosX"},"color":"green"},"\n",{"text":"Y: ","color":"yellow","bold":true},{"score":{"name":"@p","objective":"entityPosY"},"color":"green"},"\n",{"text":"Z: ","color":"yellow","bold":true},{"score":{"name":"@p","objective":"entityPosZ"},"color":"green"}]

Just replace the @p inside the tellraw with the player or mob of your choice

I created a function for this, and if you want to download it click here and drag it into your world folder. If you have never created a function and don't know what it is, check out this tutorial to understand and do this process

Still have questions? Watch the video below