Paper/patches/server/0410-Entity-isTicking.patch
2024-11-09 21:17:42 +01:00

37 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 3 Oct 2020 21:39:16 -0500
Subject: [PATCH] Entity#isTicking
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 8f103dc563110f04563487f90fe02de4288a99a7..20289623062acd34afb0ca5fc7daaf032ec1f418 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4739,5 +4739,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public static int nextEntityId() {
return ENTITY_COUNTER.incrementAndGet();
}
+
+ public boolean isTicking() {
+ return ((net.minecraft.server.level.ServerLevel) this.level).isPositionEntityTicking(this.blockPosition());
+ }
// Paper end - Expose entity id counter
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 609c768ba4d22e346acbc9422ce41e3b887fadb1..dbb1a52b1e5871bbb1ccbd300b8edb9aa0f56e49 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1058,4 +1058,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return getHandle().isInLava();
}
// Paper end - entity liquid API
+
+ // Paper start - isTicking API
+ @Override
+ public boolean isTicking() {
+ return getHandle().isTicking();
+ }
+ // Paper end - isTicking API
}