Paper/Spigot-Server-Patches/0361-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch
MiniDigger 44d032f1e9 Houston, we got a patch (#2731)
* Houston, we got a patch

* is this the end of the beginning or the beginning of the end
2019-12-12 16:20:43 +00:00

31 lines
1.5 KiB
Diff

From 69bf21627466c0f99fe7a6f3acb17c13a5926a5d 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 5f46c7f86..a0d1e7fd2 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -60,6 +60,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
@@ -146,6 +147,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.24.1