Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions paper-api/src/main/java/org/bukkit/entity/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,18 @@ final class Holder {
*/
public void setPersistent(boolean persistent);

// Paper start
/**
* @return Returns the amount of time in ticks that the entity will live before being discarded.
*/
int getDespawnTime();

/**
* @param ticks Set the amount of time in ticks that the entity will live before being discarded.
*/
void setDespawnTime(int ticks);
// Paper end

/**
* Gets the primary passenger of a vehicle. For vehicles that could have
* multiple passengers, this will only return the primary passenger.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cryptite <cryptite@gmail.com>
Date: Wed, 14 Jan 2026 18:00:17 -0600
Subject: [PATCH] Expose Entity despawnTime


diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 3bf618f1d756bad7755a87803132bd731e7c41be..0e140fd99a28eda7455a61779d52b3f0b58e06fb 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -365,7 +365,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
// Paper end
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 int despawnTime; // Paper - entity despawn time limit // private -> public, not final
public int totalEntityAge; // Paper - age-like counter for all entities
public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
// Paper start - EAR 2
Original file line number Diff line number Diff line change
Expand Up @@ -1331,4 +1331,15 @@ public boolean hasData(final @NotNull DataComponentType type) {
return this.entity.get(io.papermc.paper.datacomponent.PaperDataComponentType.bukkitToMinecraft(type)) != null;
}

// Paper start
@Override
public int getDespawnTime() {
return this.entity.despawnTime;
}

@Override
public void setDespawnTime(int ticks) {
this.entity.despawnTime = ticks;
}
// Paper end
}
Loading