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 424b05051b
commit 76fab035d3
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
3 changed files with 30 additions and 7 deletions

View File

@ -1,11 +1,11 @@
From d2dc3091b8657b318b2813a1e3ab7a1eed394ae8 Mon Sep 17 00:00:00 2001
From 1afd93a126d91c9ed1d852bc9c065c6dbdd29ec0 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 7 May 2017 06:26:09 -0500
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
@@ -308,6 +308,7 @@ public class EntityItem extends Entity {
@ -30,10 +30,11 @@ index 39a804b7c..643793d55 100644
return;
}
@@ -336,6 +343,11 @@ public class EntityItem extends Entity {
@@ -335,7 +342,11 @@ 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

@ -1,4 +1,4 @@
From bacfdeb718a1a43b35ea4cefdd5c1ca4bd00b434 Mon Sep 17 00:00:00 2001
From 3b7348ab1fc8bd6b8918e0b6a4626ef178eb22aa Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 6 Oct 2018 20:54:23 -0500
Subject: [PATCH] Implement getters and setters for EntityItem owner and
@ -6,10 +6,10 @@ 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
@@ -411,20 +411,22 @@ public class EntityItem extends Entity {
@@ -410,20 +410,22 @@ public class EntityItem extends Entity {
this.getDataWatcher().markDirty(EntityItem.b); // CraftBukkit - SPIGOT-4591, must mark dirty
}

View File

@ -0,0 +1,22 @@
From 7b2b7b222801b793995cbc5b917933a50a47c772 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
@@ -58,6 +58,7 @@ 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
--
2.21.0