mojira.dev
MC-577

Mouse buttons block all inventory controls that are not default

The Bug:

If you change any controls to Button 1, 2, 3, etc., you won't be able to use them inside of the inventory.

Steps to Reproduce:

  1. Rebind Attack/Destroy to any unused button.

  2. Rebind Drop Selected Item to the mouse button.

  3. Try to use this button.
    → ✔ It drops items as expected.

  4. Open your inventory and try to use the button.
    → ❌ It won't drop any items.

Note: Due to MC-91315, you can only use Drop Selected Items, Hotbar Slot #, and Open/Close Inventory to reproduce.

Code Analysis:

Code analysis by @unknown can be found in this comment.

Related issues

MC-286 Hotkey for mac issues MC-622 Right Click in Inventory MC-3911 Key Mapping bug MC-6589 Cannot close inventory via Middle-click when inventory is mapped to "Mouse 3" MC-8225 Use item hardcoded to Right Mouse Click MC-11676 Mouse button #3 doesn't work with new inventory dropping system MC-19433 When using Inventory-related item (crafting table, inventory, furnace, dispenser), can't place items with right-click* MC-25002 Changing "Use Item" Controls Away From Mouse2 Doesn't Work Properly MC-29234 Change Button "Use Item" don't work properly MC-30691 Mouse Button shortcuts don't work in inventory MC-41085 Crafting "right click" does not use button assigned in options MC-46022 setting "button 2" as something else, doesnt effect inventory MC-78497 Bug in keybinding MC-85477 Rebinding Inventory to an auxiliary mouse button will not close inventory as normal. MC-101400 Incomplete key reassignment MC-107047 Cannot drop items from the inventory when changed drop key. MC-117873 Inventory will open when keybinded to mouse buttons but not close once hit again MC-173962 Mouse buttons bound to hotbar don't work in inventory MC-192429 Custom inventory buttons not working MC-210709 Using a side button on a mouse to 'drop item' doesn't work as expected MC-217566 Rebinding open/close inventory to middle mouse button doesn't close GUI's MC-266222 Inventory won't close when bound to a mouse button MC-267036 Key binds meant for the mouse break for other keys when inside the inventory MC-269690 Ctrl + Q doesn't work if you use a mouse key instead of Q MC-273560 Changing the Open Inventory control removes the toggle feature MC-277551 When open/close inventory is bound to a mouse button, you cannot close the inventory. MC-278779 Mouse Buttons not closing inventory MC-295954 key bind broken

Comments

migrated

confirmed, looks like the "select half" option is hardwired to button 2 and isn't remapped with the use item binding.

migrated

Confirmed in 1.5.1.

migrated

Yeah just found this in 1.6 (My issue was apparently a duplicate, it redirected here).

_zombiehunter

Still not fixed in 13w38c, even after the devs revamped the whole controls menu !

Ezekiel

Zombie, just because they rewrote the menu doesn't mean they changed how controls are recognized.

Ezekiel

Is this still a concern in the latest Minecraft version 14w11b? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

migrated

Confirmed for 14w18b.

migrated

Still reproduceable in 14w32d

galaxy_2alex

Is this still a concern in the current Minecraft version 1.8.1 Prerelease 3 / Launcher version 1.5.3 or later? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

migrated

No response for over a year.

FaRo1

Confirmed for 1.10 and pretty much everything in between.
If this gets fixed, would a switch of left and right click make it so that right click is used for picking up and putting down stacks and left click would split them? Because I like it how it is now. But I don't think it's intended, because it's not at all possible to remap inventory keys this way. A fix that's good for both would require extra keys for that and that again would require a change of the key system of Minecraft. Maybe ignoring conflicts and just triggering both actions if there is one key selected for two actions.

FaRo1

Confirmed for 1.10.1.

SunCat

There are 2 bugs in this ticket:

  1. Mouse buttons block all inventory controls that are not default (Also MC-11676 and MC-6589)

  2. Some inventory controls can't be configured (Affects Button 1, Button 2, LShift (MC-91315, MC-81042), LCtrl)

Fixed

migrated

Confirmed in 1.12.

migrated

Confirmed in 1.12.1-pre1.

clamlol

Present in 1.13.1

migrated

Present in 1.15.2 still

migrated

confirmed in 20w16a

migrated

Confirmed in 1.16-pre2.

migrated

Confirmed in 1.16-pre5.

migrated

Confirmed in 1.16-pre7.

migrated

1,16,5 still has this issue

Basically this bug means that in inventory screen controls binded to mouse buttons dont work. Tried to play minecraft using only mouse, and stuck immediately because you cant close inventory if its binded to mouse key

migrated

1.17 still not fixed.
(Luckily Java edition is moddable)

migrated

This bug was reported almost ten years ago and is still an issue in release 1.20.4. It's easy to fix; all that has to be changed to correct the bug is to add these two if statements/branches to the method checkHotbarMouseClicked inside the AbstractContainerScreen class.

Edit: Updated the code snippet with things that I have noticed since initially writing this

// Add this to the beginning of the method
if (this.minecraft.options.keyInventory.matchesMouse(button)) {
    this.onClose();
    return;
// Add this to the first nested if statement
} else if (this.minecraft.options.keyDrop.matchesMouse(button)) {
    this.slotClicked(this.hoveredSlot, this.hoveredSlot.index, hasControlDown() ? 1 : 0, ClickType.THROW);
    return;
Brain81505

Can confirm in 23w03a

Brain81505

Can confirm in 23w04a

Brain81505

Can confirm in 23w06a

migrated

It's hard to believe that this bug still after all the time I spent playing this game. I mean, I don't remember any version when this feature worked well. I understand that many people don't have the need of change keybinds to the mouse, but is very uncomfortable for all the players that have to whatever the reason

BugTracker

Also affects 24w14a.

[Mod] turbo

(Unassigned)

Confirmed

Platform

Normal

Accessibility, UI

Minecraft 1.4.2, Minecraft 1.4.5, Minecraft 1.4.7, Snapshot 13w04a, Minecraft 1.5.1, ..., 1.21, 1.21.1, 1.21.3, 1.21.4, 1.21.5

Retrieved