-
Bug
-
Resolution: Invalid
-
Minor
-
None
-
None
-
Windows 10 / macOS 10.12.3
The problem:
When using InventoryClickEvent to monitor a numerical switch between the hot-bar and offhand slot (survival mode) the getCurrentItem() method gives always back ItemStack{AIR x 0} instead of the ItemStack that should be switched.
What is the problem (explained):
When you switch an item *from the hot-bar to the offhand slo*t (survival inventory), the InventoryAction is HOTBAR_SWAP, no problem here, but the getCurrentItem() method returns ItemStack{AIR x 0} instead of the used ItemStack for the move.
Example (for the problem):
You have a Material.SLIME_BALL (as ItemStack ofc) in slot 8 (9 on your keyboard) and if you hover over the offhand slot (in the inventory) and press '9' (on your keyboard) the slime ball will switch from being in the ninth slot to the offhand slot. BUT getCurrentItem() does not show the SLIME_BALL.
What should happen like any other InventoryAction is that getCurrentItem() for the transaction (in this case SWAP_HOTBAR) is indeed the used ItemStack.