aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0427-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch
blob: 44f01f4a06088ab0f094754d9e58d55fa8ed86de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 8e7a5ca3bc46e18ff3d7bde7ca3cbe7b713623a8 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 e723bd339e..5f6e813724 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
@@ -147,6 +148,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