I've been playing around with the Minecraft Python API and I'd like to run some of my code in response to a keypress within the game. I'm able to selectively run code based on player position or block hit events, but I'd like to bind code to a particular keypress.
You could try importing
keyboard and using code a bit like this:
import keyboard while True: try: if keyboard.is_pressed('e') print('E hotkey pressed') break else: pass except: break
Bear in mind that you have to install
pip3 install keyboard.