-
-
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
PlayerPickItemEvent should be an InventoryEvent #11372
Comments
The event is a PlayerEvent, so we can't really extend InventoryEvent; I'm also not really sure what mutations this event is supposed to be doing, all it really seems to do is change the selected slot? oh, it moves items around in a players inventory, bleh... |
Yeah, to be fully clear, if you have an item in (for example) Slot 9 and fire that packet for it, it will move into the player's held inventory slot. This caused me several hours of debugging headache until I just finally caved and used the reporting player's modpack and a packet capture and, sure enough, it was doing some bizarre crap when shift-right-clicking items in the inventory. Logging all relevant Inventory events looked identical to my own when trying to repro, but I couldn't get the dupe to occur no matter what in Vanilla. It's some odd, unused vanilla behavior or something. |
I dont understand how this could cause a dupe it just looks like a desync |
also could you link the modpack that causes the issue? |
The event does not trigger a dupe of any kind on its own. This is a developer UX issue on one hand, and an oversight in the API on the other. PlayerPickItemEvent is not built with the consideration that it can modify non-creative inventories in mind, so it does not extend InventoryEvent or provide any important context. This makes it somewhat invisible to folks making custom GUIs. There are likely many plugins that don't consider this event.
This is the modpack. It's ~175mb. I believe the specific mod here may be MouseTweaks or a different inventory QOL mod - it's the behavior where it swaps an item into your hotbar when it's consumed |
Expected behavior
The relevant packet for PlayerPickItemEvent (ServerboundPickItemPacket) is used by some mods to quick move items through the inventory to the player's hand. This event should extend InventoryEvent - it has all relevant Inventory context to provide the necessary information for an InventoryEvent.
Observed/Actual behavior
When sending a ServerboundPickItemPacket on slot 9, this event will fire and cause inventory manipulation without triggering any InventoryEvent (such as an InventoryClickEvent). This event also does not extend InventoryEvent, making it semi-invisible to Javadocs browsing for trying to handle Inventory-related exploits and bugs.
Steps/models to reproduce
Plugin and Datapack List
Paper version
Note: This paper fork only has small alterations for how Maps are updated and does not have any sweeping changes
Other
No response
The text was updated successfully, but these errors were encountered: