Use Minecraft Coordinates
A Location stores three coordinates: x, y, and z, as the following figure shows.
The x value goes west (negative) to east (positive), the z-coordinate goes north (negative) to south (positive), and y goes down (negative) to up (positive), with a y value of 0 being the bottom layer of bedrock and 64 being sea level. That means that to make a player or other entity fly up in the air, you need to add some to the y value.
We’ll get each target’s current y value from loc and save it as y. Next we’ll change the value in loc by adding 50. Here’s the fun part: by calling target.teleportTo(loc) we tell the target to teleport ...
Get Learn to Program with Minecraft Plugins, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.