Close inventory
How can I close the players inventory correctly?
I already tested Minecraft.getInstance().setScreen(null)
It closes the inventory but then you still see the mouse cursor and the window loses the focus, so you have to click on the game to change your perspective by moving the mouse.
Does anyone know how to close it correctly like I would press the key for the inventory again?
Suggestion: I'm no pro but if you look for the vanilla keybinds for opening/closing inventory then you could figure it out?
as it is in the Screen.java, use Minecraft.getInstance().setScreen((Screen)null)
If you have a Screen Overlay enabled while inventory is opened, simply use keyPressed(256 /*ESC*/,0,0) or onClose()
all this info from keyPressed() in screen.java (line 109)