SPIGOT-2000: Picking up items to shield slot working inconsistently when inventory is full

This commit is contained in:
PurkkaKoodari
2019-06-06 01:32:32 +03:00
committed by md_5
parent 7cc7719ffd
commit b7db6fba12
3 changed files with 26 additions and 0 deletions

View File

@@ -127,6 +127,9 @@
+
+ // Possibly < 0; fix here so we do not have to modify code below
+ this.pickupDelay = 0;
+ } else if (this.pickupDelay == 0) {
+ // ensure that the code below isn't triggered if canHold says we can't pick the items up
+ this.pickupDelay = -1;
+ }
+ // CraftBukkit end
+

View File

@@ -85,6 +85,12 @@
+ }
+ if (remains <= 0) return itemstack.getCount();
+ }
+ ItemStack offhandItemStack = this.getItem(this.items.size() + this.armor.size());
+ if (this.a(offhandItemStack, itemstack)) {
+ remains -= (offhandItemStack.getMaxStackSize() < this.getMaxStackSize() ? offhandItemStack.getMaxStackSize() : this.getMaxStackSize()) - offhandItemStack.getCount();
+ }
+ if (remains <= 0) return itemstack.getCount();
+
+ return itemstack.getCount() - remains;
+ }
+ // CraftBukkit end