0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/spigot.git synced 2024-11-21 20:56:14 +00:00
spigot/CraftBukkit-Patches/0010-Item-Despawn-Rate.patch
2024-10-23 02:15:00 +11:00

48 lines
1.9 KiB
Diff

From cf319036b11948c9d0e0bbc62eceaebfd2f1728a Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
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 e6969c9d0f..4067b44f68 100644
--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java
+++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java
@@ -216,7 +216,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;
@@ -566,7 +566,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 static float getSpin(float f, float f1) {
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.47.0