mcpi
mcpi copied to clipboard
How to get keyboard or mouse input?
I'm trying to move block when keyboard is pressed.
I tried pynput (https://pypi.org/project/pynput/)
But it won't recognize keyboard input from minecraft window..
Is there a way to do this?
If it's not possible, is there a way to build a ui (button) so that I can click with mouse to simulate 4 way directions?
Are you trying to move a block with the API, simulate key presses, or log key presses?
I am using keyboard, but this requires sudo. You must install it with sudo pip3 install keyboard and then run your script with sudo python3 <script_name>. It recognizes input globally, even while playing Minecraft: Pi Edition. However, my script using it, which changes the camera angle when f5 is pressed, errors out sometimes, as described in #28 and mentioned in #24.
Closing as not an issue with mcpi