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

48 lines
1.8 KiB
Diff
Raw Normal View History

2021-07-07 00:00:00 +10:00
From 419b3e12b3a926c8b35e6e21eb74246997736cee 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
2021-03-16 09:00:00 +11:00
diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java
2021-07-07 00:00:00 +10:00
index 3a902d7a2..4cdb901e7 100644
2021-03-16 09:00:00 +11:00
--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java
+++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java
2021-06-11 15:00:00 +10:00
@@ -173,7 +173,7 @@ public class EntityItem extends Entity {
2016-11-17 12:41:12 +11:00
}
}
2015-02-28 11:36:22 +00:00
2021-06-11 15:00:00 +10:00
- if (!this.level.isClientSide && this.age >= 6000) {
+ if (!this.level.isClientSide && this.age >= level.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;
2021-06-11 15:00:00 +10:00
@@ -503,7 +503,7 @@ public class EntityItem extends Entity {
2021-06-11 15:00:00 +10:00
public void t() {
this.p();
- this.age = 5999;
2021-06-11 15:00:00 +10:00
+ this.age = level.spigotConfig.itemDespawnRate - 1; // Spigot
}
2019-04-23 12:00:00 +10:00
2021-06-11 15:00:00 +10:00
public float a(float f) {
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
2021-03-09 08:47:45 +11:00
index e780cc473..0c669efaa 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
@@ -168,4 +168,11 @@ public class SpigotWorldConfig
2018-08-06 10:32:15 +10:00
mobSpawnRange = (byte) getInt( "mob-spawn-range", 6 );
2016-03-01 08:33:06 +11:00
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 );
+ }
}
--
2.25.1
2014-04-12 14:18:37 +10:00