Python Forum
mcpi module problems (player.getPos)
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mcpi module problems (player.getPos)
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems Using XBRL Module IanI 1 1,884 Jun-10-2019, 06:37 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020