-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InventoryClickEvent does not detect middle clicks (Survival mode) #11465
Comments
Update: Turns out that the behavior breaks when rebinding the middle mouse button to another button (As I have, since I develop on my macbook and there is no middle mouse button to use). |
Was able to reproduce this. Remapping
Both of these are unmapped/unknown actions, so it falls back to |
Hmm, the javadocs for |
That's fair enough. Either way though, I think it's important to be able to pick up whether a user rebound the key or not as especially those on laptops may have, and plugins which rely on middle click functionality would break completely. Also, while I'm at it, from what I can tell there might be a possibility to detect a player's middle-mouse click (or whatever the button was rebound to) while they are on survival, with no item on cursor yet an item in the slot beneath it. As it servers no functionality in survival it might be a handy way to provide plugin makers with a way to implement functionality in InventoryClickEvents. |
Is there a way to produce a ClickType MIDDLE with a vanilla client though? as far as i can tell the vanilla client doesn't even send a packet when using a middle click in survival, because of that i think this is actually a vanilla bug that the client sends a packet for the rebound middle click at all |
Vanilla bug or not, it would be dangerously fragile API to tie the 'middle click' action to only the middle click press, despite how its currently named. In fact, the current naming scheme of the entire event is kinda bad, given the ability to rebind other controls, but I don't think it's necessarily appropriate to change that now, 10 years in, what I don't want to see though, is a mix of "the name reflects the default controls so people understand the action easier" and "the name reflects the actual button being used" side by side. If you want to start renaming and deprecating, do the lot or none. |
yeah in my opinion a mojira issue should be created and for the time being the event should either not be called at all for this or the button check from the CLONE case should be removed |
Expected behavior
When printing out the result of event.getClick() during the InventoryClickEvent, I was expecting
ClickType.MIDDLE
to get printed upon clicking with the mousewheel on an item.Observed/Actual behavior
Instead, what I've found out is that no matter what one tries doing,
ClickType.MIDDLE
can never be detected.Upon middle clicking an item in an inventory (could be any inventory from what I saw), the only click being detected is
ClickType.UNKNOWN
.On discord I was initially told that detecting middle clicks isn't supported, though I find it really strange that the only way to get an
UNKNOWN
click type is through middle-clicking an item in Survival Mode.Steps/models to reproduce
ClickType.MIDDLE
Plugin and Datapack List
None, simply the above stated barebones plugin.
Paper version
This server is running Paper version 1.21.1-99-master@1bc02e6 (2024-09-25T02:41:02Z) (Implementing API version 1.21.1-R0.1-SNAPSHOT)
Other
No response
The text was updated successfully, but these errors were encountered: