There are two different ways of representing locations in the Minecraft world: Absolute and relative positions.
Because the Minecraft world is 3D, you must use 3 axes, X, Y, and Z to represent a single position.
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.
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:
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:
You'll see relative coordinates in code blocks like these:
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 CoursesUpgrade for Ultimate Minecraft Access
Unlock the Full Minecraft Experience on Tynker!
GET STARTED FOR FREETYNKER LIVE CLASSES
Accelerate your child’s coding with Tynker’s expert guidance for personalized growth.
VIEW COURSES