Python + Minecraft 坐标问题
Python + Minecraft Coordinates Trouble
下面列出的 Y 坐标会将您传送到游戏中应有的两倍。它应该将您传送到 0, 62, 0,但它会将您传送到 0, 124, 0
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
x = 0
y = 62
z = 0
mc.player.setPos(x, y, z)
根据对 mcpi documentation 的评论,坐标似乎是相对于世界出生点的:
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.
这似乎与您观察到的结果一致,即不同的坐标对在预期坐标和实际坐标中产生了共同差异(即 (0, 32, 0) (0, 98, 0)
;(0, 62, 0) (0, 128, 0)
)。
因此,要么将 66 个方块的偏移量固定到 y 轴值中,要么手动将世界生成设置为 (0, 0, 0)
/setworldspawn
。
下面列出的 Y 坐标会将您传送到游戏中应有的两倍。它应该将您传送到 0, 62, 0,但它会将您传送到 0, 124, 0
from mcpi.minecraft import Minecraft
mc = Minecraft.create()
x = 0
y = 62
z = 0
mc.player.setPos(x, y, z)
根据对 mcpi documentation 的评论,坐标似乎是相对于世界出生点的:
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.
这似乎与您观察到的结果一致,即不同的坐标对在预期坐标和实际坐标中产生了共同差异(即 (0, 32, 0) (0, 98, 0)
;(0, 62, 0) (0, 128, 0)
)。
因此,要么将 66 个方块的偏移量固定到 y 轴值中,要么手动将世界生成设置为 (0, 0, 0)
/setworldspawn
。