spigot/CraftBukkit-Patches/0012-Item-Despawn-Rate.patch

47 lines
1.7 KiB
Diff
Raw Normal View History

2018-07-22 12:00:00 +10:00
From 2ab9f497a835e3c4592e494e4a220bb8976879da Mon Sep 17 00:00:00 2001
2014-04-12 14:18:37 +10:00
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/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
2018-07-22 12:00:00 +10:00
index 9a20b640d..0ac47b585 100644
2014-04-12 14:18:37 +10:00
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
2018-07-15 10:00:00 +10:00
@@ -126,7 +126,7 @@ public class EntityItem extends Entity {
2016-11-17 12:41:12 +11:00
}
}
2015-02-28 11:36:22 +00:00
- if (!this.world.isClientSide && this.age >= 6000) {
+ if (!this.world.isClientSide && this.age >= world.spigotConfig.itemDespawnRate) { // Spigot
2014-04-12 14:18:37 +10:00
// CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0;
2018-07-15 10:00:00 +10:00
@@ -398,6 +398,6 @@ public class EntityItem extends Entity {
2018-07-15 10:00:00 +10:00
public void t() {
this.p();
- this.age = 5999;
+ this.age = world.spigotConfig.itemDespawnRate - 1; // Spigot
}
}
2014-04-12 14:18:37 +10:00
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2018-07-22 12:00:00 +10:00
index 3dee3ff5e..6a8b5cd32 100644
2014-04-12 14:18:37 +10:00
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -133,4 +133,11 @@ public class SpigotWorldConfig
2016-03-01 08:33:06 +11:00
mobSpawnRange = (byte) getInt( "mob-spawn-range", 4 );
log( "Mob Spawn Range: " + mobSpawnRange );
2014-04-12 14:18:37 +10:00
}
+
+ public int itemDespawnRate;
+ private void itemDespawnRate()
+ {
+ itemDespawnRate = getInt( "item-despawn-rate", 6000 );
+ log( "Item Despawn Rate: " + itemDespawnRate );
+ }
}
--
2018-07-15 10:00:00 +10:00
2.17.1
2014-04-12 14:18:37 +10:00