Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Python + Minecraft Coordinates Trouble

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)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading