mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 05:55:44 +01:00
SPIGOT-6115: Items being deleted on pick up with full inventory
This commit is contained in:
parent
bf451617f3
commit
3b5c367699
@ -85,7 +85,7 @@
|
|||||||
this.velocityChanged();
|
this.velocityChanged();
|
||||||
this.f = (int) ((float) this.f - f);
|
this.f = (int) ((float) this.f - f);
|
||||||
if (this.f <= 0) {
|
if (this.f <= 0) {
|
||||||
@@ -285,6 +307,45 @@
|
@@ -285,6 +307,46 @@
|
||||||
Item item = itemstack.getItem();
|
Item item = itemstack.getItem();
|
||||||
int i = itemstack.getCount();
|
int i = itemstack.getCount();
|
||||||
|
|
||||||
@ -113,12 +113,13 @@
|
|||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ // Update the ItemStack incase it was changed in the event
|
+ // Update the ItemStack if it was changed in the event
|
||||||
+ itemstack = this.getItemStack();
|
+ ItemStack current = this.getItemStack();
|
||||||
+ canHold = entityhuman.inventory.canHold(itemstack);
|
+ if (!itemstack.equals(current)) {
|
||||||
+ remaining = itemstack.getCount() - canHold;
|
+ itemstack = current;
|
||||||
+
|
+ } else {
|
||||||
+ itemstack.setCount(canHold + remaining); // = i
|
+ itemstack.setCount(canHold + remaining); // = i
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ // Possibly < 0; fix here so we do not have to modify code below
|
+ // Possibly < 0; fix here so we do not have to modify code below
|
||||||
+ this.pickupDelay = 0;
|
+ this.pickupDelay = 0;
|
||||||
@ -131,7 +132,7 @@
|
|||||||
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {
|
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {
|
||||||
entityhuman.receive(this, i);
|
entityhuman.receive(this, i);
|
||||||
if (itemstack.isEmpty()) {
|
if (itemstack.isEmpty()) {
|
||||||
@@ -328,7 +389,9 @@
|
@@ -328,7 +390,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItemStack(ItemStack itemstack) {
|
public void setItemStack(ItemStack itemstack) {
|
||||||
|
Loading…
Reference in New Issue
Block a user