aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0521-Item-no-age-no-player-pickup.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0521-Item-no-age-no-player-pickup.patch')
-rw-r--r--patches/server/0521-Item-no-age-no-player-pickup.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/patches/server/0521-Item-no-age-no-player-pickup.patch b/patches/server/0521-Item-no-age-no-player-pickup.patch
new file mode 100644
index 0000000000..13b456555a
--- /dev/null
+++ b/patches/server/0521-Item-no-age-no-player-pickup.patch
@@ -0,0 +1,50 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Alfie Smith <[email protected]>
+Date: Sat, 7 Nov 2020 01:20:33 +0000
+Subject: [PATCH] Item no age & no player pickup
+
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+index 30c954efba587d69ff55df509339f03e7d5a476e..1d90219c3a0e86786a9497d4c078c2d4077ab6cd 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+@@ -10,6 +10,12 @@ import org.bukkit.entity.Item;
+ import org.bukkit.inventory.ItemStack;
+
+ public class CraftItem extends CraftEntity implements Item {
++
++ // Paper start
++ private final static int NO_AGE_TIME = (int) Short.MIN_VALUE;
++ private final static int NO_PICKUP_TIME = (int) Short.MAX_VALUE;
++ // Paper end
++
+ private final ItemEntity item;
+
+ public CraftItem(CraftServer server, Entity entity, ItemEntity item) {
+@@ -76,6 +82,26 @@ public class CraftItem extends CraftEntity implements Item {
+ public void setCanMobPickup(boolean canMobPickup) {
+ item.canMobPickup = canMobPickup;
+ }
++
++ @Override
++ public boolean canPlayerPickup() {
++ return item.pickupDelay != NO_PICKUP_TIME;
++ }
++
++ @Override
++ public void setCanPlayerPickup(boolean canPlayerPickup) {
++ item.pickupDelay = canPlayerPickup ? 0 : NO_PICKUP_TIME;
++ }
++
++ @Override
++ public boolean willAge() {
++ return item.age != NO_AGE_TIME;
++ }
++
++ @Override
++ public void setWillAge(boolean willAge) {
++ item.age = willAge ? 0 : NO_AGE_TIME;
++ }
+ // Paper End
+
+ @Override