don't go below 0 for pickupDelay, breaks picking up items

vanilla checks for == 0

Fixes #1911
This commit is contained in:
Aikar 2019-03-24 18:12:56 -04:00
parent 310ae5b900
commit 644e1d4f8f
3 changed files with 24 additions and 3 deletions

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Implement getters and setters for EntityItem owner and
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 6752d0b8c..03fee65e4 100644
index c9473087a..e723bd339 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 39a804b7c..643793d55 100644
index 39a804b7c..921a56c31 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
@ -31,9 +31,10 @@ index 39a804b7c..643793d55 100644
}
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
// CraftBukkit end
if (this.pickupDelay == 0 && (this.g == null || 6000 - this.age <= 200 || this.g.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) {
entityhuman.receive(this, i);
- entityhuman.receive(this, i);
+ // Paper Start
+ if (flyAtPlayer) {
+ entityhuman.receive(this, i);

View file

@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 24 Mar 2019 18:09:20 -0400
Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items
vanilla checks for == 0
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index e723bd339..cf00d0c88 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -0,0 +0,0 @@ public class EntityItem extends Entity {
// CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;
+ this.pickupDelay = Math.max(0, this.pickupDelay); // Paper - don't go below 0
if (this.age != -32768) this.age += elapsedTicks;
this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end
--