mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 02:35:49 +01:00
SPIGOT-6513: Placing ItemStack in Inventory causes InventoryAction.NOTHING
By: md_5 <git@md-5.net>
This commit is contained in:
parent
1daedfe082
commit
8797975de5
1 changed files with 7 additions and 7 deletions
|
@ -1265,7 +1265,7 @@
|
|||
+ if (packetplayinwindowclick.d() == 0 || packetplayinwindowclick.d() == 1) {
|
||||
+ action = InventoryAction.NOTHING; // Don't want to repeat ourselves
|
||||
+ if (packetplayinwindowclick.c() == -999) {
|
||||
+ if (!player.inventoryMenu.getCarried().isEmpty()) {
|
||||
+ if (!player.containerMenu.getCarried().isEmpty()) {
|
||||
+ action = packetplayinwindowclick.d() == 0 ? InventoryAction.DROP_ALL_CURSOR : InventoryAction.DROP_ONE_CURSOR;
|
||||
+ }
|
||||
+ } else if (packetplayinwindowclick.c() < 0) {
|
||||
|
@ -1274,7 +1274,7 @@
|
|||
+ Slot slot = this.player.containerMenu.getSlot(packetplayinwindowclick.c());
|
||||
+ if (slot != null) {
|
||||
+ ItemStack clickedItem = slot.getItem();
|
||||
+ ItemStack cursor = player.inventoryMenu.getCarried();
|
||||
+ ItemStack cursor = player.containerMenu.getCarried();
|
||||
+ if (clickedItem.isEmpty()) {
|
||||
+ if (!cursor.isEmpty()) {
|
||||
+ action = packetplayinwindowclick.d() == 0 ? InventoryAction.PLACE_ALL : InventoryAction.PLACE_ONE;
|
||||
|
@ -1362,7 +1362,7 @@
|
|||
+ action = InventoryAction.NOTHING;
|
||||
+ } else {
|
||||
+ Slot slot = this.player.containerMenu.getSlot(packetplayinwindowclick.c());
|
||||
+ if (slot != null && slot.hasItem() && player.getAbilities().instabuild && player.inventoryMenu.getCarried().isEmpty()) {
|
||||
+ if (slot != null && slot.hasItem() && player.getAbilities().instabuild && player.containerMenu.getCarried().isEmpty()) {
|
||||
+ action = InventoryAction.CLONE_STACK;
|
||||
+ } else {
|
||||
+ action = InventoryAction.NOTHING;
|
||||
|
@ -1407,8 +1407,8 @@
|
|||
+ case PICKUP_ALL:
|
||||
+ click = ClickType.DOUBLE_CLICK;
|
||||
+ action = InventoryAction.NOTHING;
|
||||
+ if (packetplayinwindowclick.c() >= 0 && !this.player.inventoryMenu.getCarried().isEmpty()) {
|
||||
+ ItemStack cursor = this.player.inventoryMenu.getCarried();
|
||||
+ if (packetplayinwindowclick.c() >= 0 && !this.player.containerMenu.getCarried().isEmpty()) {
|
||||
+ ItemStack cursor = this.player.containerMenu.getCarried();
|
||||
+ action = InventoryAction.NOTHING;
|
||||
+ // Quick check for if we have any of the item
|
||||
+ if (inventory.getTopInventory().contains(CraftMagicNumbers.getMaterial(cursor.getItem())) || inventory.getBottomInventory().contains(CraftMagicNumbers.getMaterial(cursor.getItem()))) {
|
||||
|
@ -1492,7 +1492,7 @@
|
|||
+ case PLACE_SOME:
|
||||
+ case PLACE_ONE:
|
||||
+ case SWAP_WITH_CURSOR:
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventoryMenu.getCarried()));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.containerMenu.getCarried()));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(this.player.containerMenu.containerId, packetplayinwindowclick.c(), this.player.containerMenu.getSlot(packetplayinwindowclick.c()).getItem()));
|
||||
+ break;
|
||||
+ // Modified clicked only
|
||||
|
@ -1504,7 +1504,7 @@
|
|||
+ case DROP_ALL_CURSOR:
|
||||
+ case DROP_ONE_CURSOR:
|
||||
+ case CLONE_STACK:
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventoryMenu.getCarried()));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.containerMenu.getCarried()));
|
||||
+ break;
|
||||
+ // Nothing
|
||||
+ case NOTHING:
|
||||
|
|
Loading…
Reference in a new issue