aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0506-Entity-isTicking.patch
blob: 2b9164a120415c678ddf4e6841987ddd0cbbc236 (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
37
38
39
40
41
42
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 35825b598778e6b8aef613263abab1a8d4ab4af3..c4f528fac063b2f8a4955d00e4220fcbd0867a61 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -56,6 +56,7 @@ import net.minecraft.resources.ResourceKey;
 import net.minecraft.resources.ResourceLocation;
 import net.minecraft.server.MCUtil;
 import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ServerChunkCache;
 import net.minecraft.server.level.ServerLevel;
 import net.minecraft.server.level.ServerPlayer;
 import net.minecraft.server.level.TicketType;
@@ -4018,5 +4019,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
     public static int nextEntityId() {
         return ENTITY_COUNTER.incrementAndGet();
     }
+
+    public boolean isTicking() {
+        return ((ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
+    }
     // Paper end
 }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 8ec7cd4ea41c28c1f730df649b7cf73d57d60b55..c63301472922dceb2873553bb4b0c350b37a23c3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1267,5 +1267,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
     public boolean isInLava() {
         return getHandle().isInLava();
     }
+
+    public boolean isTicking() {
+        return getHandle().isTicking();
+    }
     // Paper end
 }