Skip to content

Keep cursor item when opening a shulkerbox.#51

Open
DungeonDev wants to merge 1 commit intolMartin3:masterfrom
DungeonDev:keep_cursor_item
Open

Keep cursor item when opening a shulkerbox.#51
DungeonDev wants to merge 1 commit intolMartin3:masterfrom
DungeonDev:keep_cursor_item

Conversation

@DungeonDev
Copy link
Copy Markdown

@DungeonDev DungeonDev commented Mar 22, 2023

Fixes #40 and fixes #49.

Keeps the current cursor item when opening a shulker, fixing the issue of cursor items being deleted when right-clicking a shulker in your inventory when not already having a shulker opened. Also has the added effect of making it easier to move stuff between shulkers.

The root cause of the issue is that player.openInventory deletes the cursor item if it exists. If you already have a shulker open, the player.closeInventory that happens earlier puts the cursor item in the player inventory, or drops it if there is no space.

This PR saves the cursor item and then sets the cursor item to null before closing the previous inventory, restoring cursor item back to the saved item after opening the shulker, making sure the call to closeInventory does not cause item duplication.

@Folas1337
Copy link
Copy Markdown

Wohooo, can't wait for this to be added so I can enable the feature again \o/

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.

Item disappearing bug [Bug] Item Despawn on Rightklick (In Inventory)

2 participants