MCP-Reborn icon indicating copy to clipboard operation
MCP-Reborn copied to clipboard

Close inventory

Open RobinP2000 opened this issue 3 years ago • 2 comments

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?

RobinP2000 avatar Jan 29 '22 09:01 RobinP2000

Suggestion: I'm no pro but if you look for the vanilla keybinds for opening/closing inventory then you could figure it out?

PolymorphicAgent avatar Jan 31 '22 20:01 PolymorphicAgent

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)

GavinGoGaming avatar May 22 '22 22:05 GavinGoGaming