The Y coordinate listed below teleports you to double what it’s supposed to ingame. It is supposed to teleport you to 0, 62, 0, but it teleports you to 0, 124, 0
from mcpi.minecraft import Minecraft mc = Minecraft.create() x = 0 y = 62 z = 0 mc.player.setPos(x, y, z)
Advertisement
Answer
Per comments on the documentation for mcpi, it would appear that the coordinates are relative to the world spawn:
getPos, getTilePos, setPos and setTilePos all appear to be relative to the player’s spawn point at least in a single player world. I am going through trying to teleport my character but the coordinates I end up on are not the world’s coordinates but a coordinate relative to where my character would spawn.
This appears to hold true with the results you observed, which were that different coordinate pairs produced a common difference in the expected and actual coordinates (i.e. (0, 32, 0) (0, 98, 0)
; (0, 62, 0) (0, 128, 0)
).
So, either fix an offset of 66 blocks into the y-axis values, or manually set the world spawn to (0, 0, 0)
with /setworldspawn
.