Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
71c84c8132
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 9a80d38c SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-722: Add EntityRemoveEvent 258086d9 SPIGOT-7417, PR-967: Add Sign#getTargetSide and Sign#getAllowedEditor ffaba051 SPIGOT-7584: Add missing Tag.ITEMS_NON_FLAMMABLE_WOOD CraftBukkit Changes: 98b6c1ac7 SPIGOT-7589 Fix NullPointerException when bans expire a2736ddb0 SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, PR-1008: Add EntityRemoveEvent 5bf12cb89 SPIGOT-7565: Throw a more descriptive error message when a developer tries to spawn an entity from a CraftBukkit class 76d95fe7e SPIGOT-7417, PR-1343: Add Sign#getTargetSide and Sign#getAllowedEditor Spigot Changes: e9ec5485 Rebuild patches f1b62e0c Rebuild patches
64 Zeilen
3.7 KiB
Diff
64 Zeilen
3.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: kickash32 <kickash32@gmail.com>
|
|
Date: Mon, 3 Jun 2019 02:02:39 -0400
|
|
Subject: [PATCH] Alternative item-despawn-rate
|
|
|
|
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
index 5994cb69575d365f435f5ef6da5fa61ee9298fe1..e67e8d0593e3ba3fc8e9da59ad6494ea589ab337 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
|
@@ -57,6 +57,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
|
public final float bobOffs;
|
|
private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
|
|
public boolean canMobPickup = true; // Paper - Item#canEntityPickup
|
|
+ private int despawnRate = -1; // Paper - Alternative item-despawn-rate
|
|
|
|
public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
|
|
super(type, world);
|
|
@@ -209,7 +210,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
|
}
|
|
}
|
|
|
|
- if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
|
|
+ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate
|
|
// CraftBukkit start - fire ItemDespawnEvent
|
|
if (CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
|
this.age = 0;
|
|
@@ -233,7 +234,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
|
this.lastTick = MinecraftServer.currentTick;
|
|
// CraftBukkit end
|
|
|
|
- if (!this.level().isClientSide && this.age >= this.level().spigotConfig.itemDespawnRate) { // Spigot
|
|
+ if (!this.level().isClientSide && this.age >= this.despawnRate) { // Spigot // Paper - Alternative item-despawn-rate
|
|
// CraftBukkit start - fire ItemDespawnEvent
|
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
|
this.age = 0;
|
|
@@ -289,7 +290,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
|
private boolean isMergable() {
|
|
ItemStack itemstack = this.getItem();
|
|
|
|
- return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < 6000 && itemstack.getCount() < itemstack.getMaxStackSize();
|
|
+ return this.isAlive() && this.pickupDelay != 32767 && this.age != -32768 && this.age < this.despawnRate && itemstack.getCount() < itemstack.getMaxStackSize(); // Paper - Alternative item-despawn-rate
|
|
}
|
|
|
|
private void tryToMerge(ItemEntity other) {
|
|
@@ -532,6 +533,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
|
|
|
public void setItem(ItemStack stack) {
|
|
this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
|
|
+ this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper - Alternative item-despawn-rate
|
|
}
|
|
|
|
@Override
|
|
@@ -586,7 +588,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
|
|
|
public void makeFakeItem() {
|
|
this.setNeverPickUp();
|
|
- this.age = this.level().spigotConfig.itemDespawnRate - 1; // Spigot
|
|
+ this.age = this.despawnRate - 1; // Spigot // Paper - Alternative item-despawn-rate
|
|
}
|
|
|
|
public float getSpin(float tickDelta) {
|