Skip to content

Add toggle inventory/crafting with E and C/R keys#593

Merged
codeHusky merged 1 commit intosmartcmd:mainfrom
Adem-Kurt:patch-2
Mar 7, 2026
Merged

Add toggle inventory/crafting with E and C/R keys#593
codeHusky merged 1 commit intosmartcmd:mainfrom
Adem-Kurt:patch-2

Conversation

@Adem-Kurt
Copy link
Contributor

Description

Add toggle behavior for inventory and crafting menus when using keyboard (E and C/R keys). Previously, pressing the key again while the menu was open does not close the menu.

Changes

Previous Behavior

When pressing the inventory key (E) or crafting key (C/R), the corresponding menu would open. However, pressing the same key again while the menu was already open would not close it.

Root Cause

The keyboard input polling code in Minecraft.cpp (inside the _WINDOWS64 KBM input block) does not check whether a container menu is already open.

New Behavior

Pressing E while a container menu (inventory, crafting, chest, etc.) is open will now close it. Pressing C/R while a container menu is open will also close it. This matches the expected toggle behavior from Java Edition.

Fix Implementation

In Minecraft.cpp handlers now check ui.IsSceneInStack. If a container menu is already displayed, ui.CloseUIScenes(i) is called instead of setting the action flag.

AI Use Disclosure

I used AI as a search tool to navigate the codebase and find the required UI controller APIs (like IsSceneInStack), but the logic and implementation are completely my own.

Related Issues

@codeHusky codeHusky closed this Mar 5, 2026
@codeHusky codeHusky reopened this Mar 5, 2026
@codeHusky codeHusky merged commit 8f2ae54 into smartcmd:main Mar 7, 2026
1 check passed
@Adem-Kurt Adem-Kurt deleted the patch-2 branch March 7, 2026 02:48
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

Successfully merging this pull request may close these issues.

2 participants