testserver/patches/server/0530-Entity-isTicking.patch

43 lines
1.9 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00:00
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 99d7be13ad0037eb2b8d7b8d1dbbc057727e3424..b659b497f42c01df825d27a9cf4a581edbfb36e7 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
2021-06-14 14:41:34 +00:00
@@ -52,6 +52,7 @@ import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
2021-06-11 12:02:28 +00:00
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;
@@ -3929,5 +3930,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
2021-06-11 12:02:28 +00:00
public static int nextEntityId() {
return ENTITY_COUNTER.incrementAndGet();
}
+
+ public boolean isTicking() {
2021-06-14 15:17:08 +00:00
+ return ((ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
2021-06-11 12:02:28 +00:00
+ }
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
2021-06-17 21:39:36 +00:00
index 3c3614f0f8af3fb2c593dd1154bd64c70713a42e..8246ad7ebecdfc0b7519fe4412fef7b07407e850 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1202,5 +1202,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
2021-06-11 12:02:28 +00:00
public boolean isInLava() {
return getHandle().isInLava();
}
+
+ public boolean isTicking() {
+ return getHandle().isTicking();
+ }
// Paper end
}