aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0317-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch
blob: 309d46c6a4ad2fb9082a1b763d249530370e4e16 (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
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/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index b374d50678e92fabbf1d640729a8a276fc791c62..b72bb3b78a3b19edb67e74bdc03a46060a1f6af3 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -106,6 +106,7 @@ public class ItemEntity 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
@@ -192,6 +193,7 @@ public class ItemEntity 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