mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
Item Despawn Rate
By: md_5 <git@md-5.net>
This commit is contained in:
parent
19bfb10583
commit
54a84c6c79
@ -94,11 +94,13 @@
|
||||
|
||||
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -202,7 +215,13 @@
|
||||
@@ -201,8 +214,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide && this.age >= 6000) {
|
||||
- if (!this.level().isClientSide && this.age >= 6000) {
|
||||
- this.discard();
|
||||
+ if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
|
||||
+ // CraftBukkit start - fire ItemDespawnEvent
|
||||
+ if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
||||
+ this.age = 0;
|
||||
@ -233,3 +235,12 @@
|
||||
itemstack.setCount(i);
|
||||
}
|
||||
|
||||
@@ -492,7 +564,7 @@
|
||||
|
||||
public void makeFakeItem() {
|
||||
this.setNeverPickUp();
|
||||
- this.age = 5999;
|
||||
+ this.age = this.level().spigotConfig.itemDespawnRate - 1; // Spigot
|
||||
}
|
||||
|
||||
public static float getSpin(float f, float f1) {
|
||||
|
@ -187,4 +187,11 @@ public class SpigotWorldConfig
|
||||
this.mobSpawnRange = (byte) this.getInt( "mob-spawn-range", 6 );
|
||||
this.log( "Mob Spawn Range: " + this.mobSpawnRange );
|
||||
}
|
||||
|
||||
public int itemDespawnRate;
|
||||
private void itemDespawnRate()
|
||||
{
|
||||
this.itemDespawnRate = this.getInt( "item-despawn-rate", 6000 );
|
||||
this.log( "Item Despawn Rate: " + this.itemDespawnRate );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user