I am trying to move my camera in minecraft with python

Question:

I have successfully found out how to move, drag, and click in Minecraft with python code. The only thing is that I have gotten the cursor to work in the inventory/crafting menu. One line I used to go up was

pyautogui.moveRel(0, -33, duration=0.1)

For some reason, this does not work outside the crafting menu. I am not able to move the camera in the open-world part of Minecraft. I had a problem with the keyboard as well, it would type the keys I would want it to in a text box but not in the real game. I fixed this by using keyboard.press() and keyboard.release() instead of using pyautogui. Pyautogui works for clicking and moving in the crafting menu but not in the real game.

Any thoughts on how to move the camera in-game?

Asked By: Garousome

||

Answers:

Pyautogui does not work on video games on Windows or any other common OS. I suggest trying https://pypi.org/project/mouse/, as the keyboard function worked for other people.

Answered By: CheetSheatOverlode

Pyhon DirectInput Mouse Relative Moving act not as expected

Looking at this, I found the answer. I was trying to move the mouse where the game has a specific directinput I needed to use. I just called MouseMoveTo() with the desired numbers.

For some reason it only works like this MouseMoveTo(0,100,) with the added comma at the end

Answered By: Garousome

I got it to work by turning off Raw Input in the Mouse Settings. Which are in Options > Controls > Mouse Settings > Raw Input

Answered By: personman61