How do locations in Minecraft mods work? What are absolute and relative coordinates?

There are two different ways of representing locations in the Minecraft world: Absolute and relative positions.

Absolute Position

Because the Minecraft world is 3D, you must use 3 axes, X, Y, and Z to represent a single position.

  • The X-axis runs West-to-East
  • The Y-axis describes vertical height (sometimes called elevation)
  • The Z-axis runs North-to-South

coordinates.png

Representing a single location in this way is called its Absolute Position or sometimes its World Position. For example, here's one code block that uses an absolute location.

move-tynkerbot.png

This code block teleports the TynkerBot anywhere you like. Just update the numbers in the block.

HINT: You can display your current coordinate position within the Minecraft world by entering this command into chat (open chat by pressing T) /gamerule showcoordinates true. You should see something like this appear in the upper left:

position-chat.png

Relative Position

But more often than not, you'll also want to use coordinates that are relative to a player's current position. For example, if you wanted to build a fence that was 5 blocks south of the player's current position. Or dig a hole, straight down! (Since players are two blocks tall, these locations are relative to the player's feet.)

Relative location is indicated in code using the squiggly line ~, which is called a tilde (till-deh). The notation for coordinates looks like this:

~X ~Y ~Z

You can think of relative location as an "offset" or a "change in" location in a certain direction, where:

  • A positive change in X is moving East (negative is West)
  • A positive change in Y is moving Upwards in elevation (negative is Downward)
  • A positive Z is South (negative is North)

You'll see relative coordinates in code blocks like these:

teleport-player.png

summon-chicken.png

HINT: Notice how these blocks and all relative locations are relative to the cardinal directions (that is, North, South, East, and West, rather than the direction your player is currently facing).

Or browse available courses for Tynker subscribers:

Browse Minecraft Courses

Still need help? Contact us

Upgrade for Ultimate Minecraft Access

Unlock the Full Minecraft Experience on Tynker!

GET STARTED FOR FREE

TYNKER LIVE CLASSES

Accelerate your child’s coding with Tynker’s expert guidance for personalized growth.

VIEW COURSES
Explore Your Creativity
Your Minecraft Exploration Starts Now!
Tynker is the #1 way kids learn to code Get Started for Free