spigot/CraftBukkit-Patches/0011-Item-Despawn-Rate.patch
2023-09-22 02:40:00 +10:00

47 lines
1.9 KiB
Diff

From b9f5cf80f893f8534be4b90427398b7b2b8a7c73 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 22 Sep 2013 19:10:53 +1000
Subject: [PATCH] Item Despawn Rate
diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java
index 15d0290ba7..8e26d92c47 100644
--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java
+++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java
@@ -189,7 +189,7 @@ public class EntityItem extends Entity implements TraceableEntity {
}
}
- if (!this.level().isClientSide && this.age >= 6000) {
+ if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
// CraftBukkit start - fire ItemDespawnEvent
if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;
@@ -518,7 +518,7 @@ public class EntityItem extends Entity implements TraceableEntity {
public void makeFakeItem() {
this.setNeverPickUp();
- this.age = 5999;
+ this.age = this.level().spigotConfig.itemDespawnRate - 1; // Spigot
}
public float getSpin(float f) {
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 0c0c29efe5..e3682d28ca 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -187,4 +187,11 @@ public class SpigotWorldConfig
mobSpawnRange = (byte) getInt( "mob-spawn-range", 6 );
log( "Mob Spawn Range: " + mobSpawnRange );
}
+
+ public int itemDespawnRate;
+ private void itemDespawnRate()
+ {
+ itemDespawnRate = getInt( "item-despawn-rate", 6000 );
+ log( "Item Despawn Rate: " + itemDespawnRate );
+ }
}
--
2.42.0