aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0311-Alternative-item-despawn-rate.patch
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2024-06-14 14:07:44 -0700
committerJake Potrebic <[email protected]>2024-06-14 14:07:44 -0700
commitffe310a8e1dd4ed1027e903b4683f0ab42ee9ff8 (patch)
tree7748595488691c8494b5bdb2d01711a5242f6b34 /patches/server/0311-Alternative-item-despawn-rate.patch
parent188cff20c75367d8c90ae548a0dd528805d4a5a3 (diff)
downloadPaper-ffe310a8e1dd4ed1027e903b4683f0ab42ee9ff8.tar.gz
Paper-ffe310a8e1dd4ed1027e903b4683f0ab42ee9ff8.zip
remove api that was scheduled for removal
Diffstat (limited to 'patches/server/0311-Alternative-item-despawn-rate.patch')
-rw-r--r--patches/server/0311-Alternative-item-despawn-rate.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/patches/server/0311-Alternative-item-despawn-rate.patch b/patches/server/0311-Alternative-item-despawn-rate.patch
new file mode 100644
index 0000000000..5f9a648f99
--- /dev/null
+++ b/patches/server/0311-Alternative-item-despawn-rate.patch
@@ -0,0 +1,63 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: kickash32 <[email protected]>
+Date: Mon, 3 Jun 2019 02:02:39 -0400
+Subject: [PATCH] Alternative item-despawn-rate
+
+Co-authored-by: Noah van der Aa <[email protected]>
+
+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 8351e46f667a8f8dd96d97ec15c0165261a2fab4..2e550c7db6cebc941590c35337fd47416407a5aa 100644
+--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
++++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+@@ -62,6 +62,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
+ public final float bobOffs;
+ private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
+ public boolean canMobPickup = true; // Paper - Item#canEntityPickup
++ private int despawnRate = -1; // Paper - Alternative item-despawn-rate
+
+ public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
+ super(type, world);
+@@ -216,7 +217,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
+ }
+ }
+
+- if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
++ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate
+ // CraftBukkit start - fire ItemDespawnEvent
+ if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
+ this.age = 0;
+@@ -240,7 +241,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
+ this.lastTick = MinecraftServer.currentTick;
+ // CraftBukkit end
+
+- if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
++ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate
+ // CraftBukkit start - fire ItemDespawnEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
+ this.age = 0;
+@@ -296,7 +297,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
+ private boolean isMergable() {
+ ItemStack itemstack = this.getItem();
+
+- return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < 6000 && itemstack.getCount() < itemstack.getMaxStackSize();
++ return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < this.despawnRate && itemstack.getCount() < itemstack.getMaxStackSize(); // Paper - Alternative item-despawn-rate
+ }
+
+ private void tryToMerge(ItemEntity other) {
+@@ -544,6 +545,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
+
+ public void setItem(ItemStack stack) {
+ this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
++ this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper - Alternative item-despawn-rate
+ }
+
+ @Override
+@@ -598,7 +600,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
+
+ public void makeFakeItem() {
+ this.setNeverPickUp();
+- this.age = this.level().spigotConfig.itemDespawnRate - 1; // Spigot
++ this.age = this.despawnRate - 1; // Spigot // Paper - Alternative item-despawn-rate
+ }
+
+ public float getSpin(float tickDelta) {