Repository navigation
Let players use their own inventory while a panel is open - #3100
Merged
Merged
Conversation
#2767 tried this by only cancelling clicks in the panel itself, but that stopped icon pickers seeing clicks in the player's inventory (#2776) and let shift-clicks and drags move items into panels, where they were lost. It was reverted in 3.11.1. This version keeps routing player-inventory clicks to the panel and only lets them through when: - the action cannot move an item into the panel (pickup, place, swap, hotbar swap, drop, bundles; not shift-click or double-click), and - the panel has no listener, or its listener opts in via the new PanelListener#allowsPlayerInventoryClicks() (default false, so addon icon pickers are unaffected). TabbedPanel and AbstractRefreshingPanel opt in. A held item can never be placed in a panel, even if a click handler uncancels the click, and drags that touch panel slots are cancelled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Brings back the goal of #2767 (moving items, dropping them and using bundles in your own inventory while a BentoBox panel is open) without the regressions that got it reverted in 3.11.1 (#2776: icon pickers broke, and shift-clicks or drags could move items into panels, where they were lost).
How
InventoryActioncan't put an item into the panel: pickup, place, swap with cursor, hotbar/offhand swap, drop (Q / Ctrl+Q) and the bundle actions. Shift-click (MOVE_TO_OTHER_INVENTORY) and double-click (COLLECT_TO_CURSOR) stay blocked.PanelListener#allowsPlayerInventoryClicks()defaults tofalse, so panels that read inventory clicks (the coreIconChanger, and the Challenges and Biomes edit panels) see them exactly as before.TabbedPanelandAbstractRefreshingPanel(settings, command ranks) opt in. Panels without a listener can't read these clicks, so they always allow them.false.InventoryDragEventhandler cancels drags that touch any panel slot.API
PanelListener#allowsPlayerInventoryClicks()is a new default method, so it's binary compatible. It's tagged@since 3.23.4.Testing
PanelListenerManagerTest; the full suite passes (3,597 tests)./is settings,/bsbadmin settingsand/bentobox manage(inventory moves, drops, bundles, blocked shift-click/double-click/drag, no item loss on close) and the icon pickers in/bsbadmin blueprintand/bsbadmin challenges. Everything worked.Refs #2767, #2776