2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Alfie Smith <alfie@alfiesmith.net>
|
|
|
|
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
|
2024-01-19 22:13:42 +01:00
|
|
|
index 5620a0849fda49313c68edfd747fedd09641a3d5..4a15c3786edbfeae3367c0b20fb6aee11d62aea6 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
|
2023-10-22 21:12:00 +02:00
|
|
|
@@ -9,6 +9,11 @@ import org.bukkit.inventory.ItemStack;
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
public class CraftItem extends CraftEntity implements Item {
|
2023-10-22 21:12:00 +02:00
|
|
|
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // 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
|
|
|
|
+
|
2023-10-22 21:12:00 +02:00
|
|
|
public CraftItem(CraftServer server, ItemEntity entity) {
|
|
|
|
super(server, entity);
|
|
|
|
}
|
|
|
|
@@ -73,6 +78,26 @@ public class CraftItem extends CraftEntity implements Item {
|
2021-06-11 14:02:28 +02:00
|
|
|
public void setCanMobPickup(boolean canMobPickup) {
|
2023-10-22 21:12:00 +02:00
|
|
|
this.getHandle().canMobPickup = canMobPickup;
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean canPlayerPickup() {
|
2023-10-22 21:12:00 +02:00
|
|
|
+ return this.getHandle().pickupDelay != NO_PICKUP_TIME;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setCanPlayerPickup(boolean canPlayerPickup) {
|
2023-10-22 21:12:00 +02:00
|
|
|
+ this.getHandle().pickupDelay = canPlayerPickup ? 0 : NO_PICKUP_TIME;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean willAge() {
|
2023-10-22 21:12:00 +02:00
|
|
|
+ return this.getHandle().age != NO_AGE_TIME;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void setWillAge(boolean willAge) {
|
2023-10-22 21:12:00 +02:00
|
|
|
+ this.getHandle().age = willAge ? 0 : NO_AGE_TIME;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
2024-01-19 22:13:42 +01:00
|
|
|
// Paper end
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
@Override
|