aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0416-Entity-isTicking.patch
blob: c00b5f821bf5e27f44529e9b22c50e2d45d69028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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 203aacc9e116c1335bde1cff4d59674bfa7a622a..0764f5eaaa5a13e1e9b98a83bfb32e8eb1278f23 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4514,5 +4514,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.ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
+    }
     // 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 5f5788a502642463091fb76e98703aaec7a86836..98e8ad81b8c9c0636abe59f70ce891fe926a37fe 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1062,4 +1062,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
 }