geforkt von Mirrors/Paper
aa52bf9e33
Mojang made some changes to priorities in 1.17 and it seems that these changes conflict with the changes made in this patch, which in some cases appears to cause excessive rescheduling of tasks. This, however, is not confirmed as such but seems to be the behavior that we're seeing to cause this issue, if mojang has adopted the changes we suggested, then a good chunk of this patch may be unneeded, but, this needs a much better look than I'm currently able to do
51 Zeilen
1.7 KiB
Diff
51 Zeilen
1.7 KiB
Diff
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
|
|
index 0d262c99c7e9ef06e297612b1802c493700f64ae..342345eb04d00efb58392ccf209e3c51c1064173 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) {
|
|
@@ -59,6 +65,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
|