Python Forum
mcpi module problems (player.getPos) - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: mcpi module problems (player.getPos) (/thread-16853.html)



mcpi module problems (player.getPos) - SheeppOSU - Mar-17-2019

I have a function to detect when the player touches the start line and then changes their camera position to a different view. The only problem is when the player gets to a specific z coordinate I get an error saying getPos() failed me.

Here's the script
def check(pos):
    print(round(pos.z))
    if round(pos.z) == 290:
        mc.camera.setPos(549, 104, 306)
        mc.camera.setFixed()
        checkVar = True

while checkVar == False:
    pos = mc.player.getPos()
    check(pos)
Here's the error
Error:
Traceback (most recent call last): File "C:\Users\Chadd\Desktop\Ayden Stuff\Python-Minecraft.py", line 31, in <module> pos = mc.player.getPos() File "C:\Users\Chadd\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mcpi\minecraft.py", line 66, in getPos return CmdPositioner.getPos(self, []) File "C:\Users\Chadd\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mcpi\minecraft.py", line 32, in getPos s = self.conn.sendReceive(self.pkg + b".getPos", id) File "C:\Users\Chadd\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mcpi\connection.py", line 63, in sendReceive return self.receive() File "C:\Users\Chadd\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mcpi\connection.py", line 57, in receive raise RequestError("%s failed"%self.lastSent.strip()) mcpi.connection.RequestError: b'player.getPos()' failed