Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get keyboard or mouse input? #17

Closed
littlehome-eugene opened this issue Nov 3, 2020 · 3 comments
Closed

How to get keyboard or mouse input? #17

littlehome-eugene opened this issue Nov 3, 2020 · 3 comments

Comments

@littlehome-eugene
Copy link

littlehome-eugene commented Nov 3, 2020

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?

@Bigjango13
Copy link

Are you trying to move a block with the API, simulate key presses, or log key presses?

@xboxone08
Copy link

xboxone08 commented Jul 5, 2022

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.

@martinohanlon
Copy link
Owner

Closing as not an issue with mcpi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants