Paper/patches/server/0320-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch

28 lines
1.6 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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
2021-06-13 13:40:34 +02:00
index 0741dcbd06395b4696eb6083128a5d9b679cb3fb..82ffe3624943d2e931e2cc2f85ede94f369bd06b 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
2021-06-13 13:40:34 +02:00
@@ -105,6 +105,7 @@ public class ItemEntity extends Entity {
2021-06-11 14:02:28 +02:00
// 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
2021-06-13 13:40:34 +02:00
@@ -193,6 +194,7 @@ public class ItemEntity extends Entity {
2021-06-11 14:02:28 +02:00
// 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