diff options
author | Nassim Jahnke <[email protected]> | 2024-11-28 11:38:18 +0100 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-11-29 10:52:17 +0100 |
commit | 71b5b9894ddbd7a9486f0cd8457af9c5ccdbe792 (patch) | |
tree | 28ffdb57a00ff12f2aa1155ed8cd72cdc781319b /patches/server/1070-Configurable-Entity-Despawn-Time.patch | |
parent | 031ca6dcff86845d0d13524f5a9e1d0c3a7f9841 (diff) | |
download | Paper-pool-nonsense.tar.gz Paper-pool-nonsense.zip |
Move patch back a bitpool-nonsense
Diffstat (limited to 'patches/server/1070-Configurable-Entity-Despawn-Time.patch')
-rw-r--r-- | patches/server/1070-Configurable-Entity-Despawn-Time.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/patches/server/1070-Configurable-Entity-Despawn-Time.patch b/patches/server/1070-Configurable-Entity-Despawn-Time.patch new file mode 100644 index 0000000000..3885f857a3 --- /dev/null +++ b/patches/server/1070-Configurable-Entity-Despawn-Time.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Kevin Raneri <[email protected]> +Date: Mon, 30 Sep 2024 09:50:55 -0700 +Subject: [PATCH] Configurable Entity Despawn Time + + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 8c62d1aa5c8a062685474dca7e91bf9f8b004ca5..a15546e433ebba6c0de01bdaaef201a3d99a87b5 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -388,6 +388,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + private UUID originWorld; + public boolean freezeLocked = false; // Paper - Freeze Tick Lock API + public boolean fixedPose = false; // Paper - Expand Pose API ++ private final int despawnTime; // Paper - entity despawn time limit + + public void setOrigin(@javax.annotation.Nonnull Location location) { + this.origin = location.toVector(); +@@ -570,6 +571,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + + public Entity(EntityType<?> type, Level world) { + this.id = Entity.ENTITY_COUNTER.incrementAndGet(); ++ this.despawnTime = type == EntityType.PLAYER ? -1 : world.paperConfig().entities.spawning.despawnTime.getOrDefault(type, io.papermc.paper.configuration.type.number.IntOr.Disabled.DISABLED).or(-1); // Paper - entity despawn time limit + this.passengers = ImmutableList.of(); + this.deltaMovement = Vec3.ZERO; + this.bb = Entity.INITIAL_AABB; +@@ -868,6 +870,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + } + + public void tick() { ++ // Paper start - entity despawn time limit ++ if (this.despawnTime >= 0 && this.tickCount >= this.despawnTime) { ++ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); ++ return; ++ } ++ // Paper end - entity despawn time limit + this.baseTick(); + } + |