Paper/patches/server-unmapped/0573-Entity-isTicking.patch
2021-06-11 14:02:28 +02:00

43 lines
1.9 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 9b6e5f279a22efc2d015e2d31076a8c06e6b3886..d072e3fb26f32db80be68f0e23526e34f57ff331 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -48,6 +48,7 @@ import net.minecraft.resources.MinecraftKey;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.MCUtil;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ChunkProviderServer;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.server.level.PlayerChunkMap;
import net.minecraft.server.level.TicketType;
@@ -3483,5 +3484,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
public static int nextEntityId() {
return entityCount.incrementAndGet();
}
+
+ public boolean isTicking() {
+ return ((ChunkProviderServer) world.getChunkProvider()).isInEntityTickingChunk(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 fb52a60437d48282f3e99e7eccb0e76b446155f9..295ffab08672d77d88aca368cb5b56f80bc4f1b5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1161,5 +1161,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean isInLava() {
return getHandle().isInLava();
}
+
+ public boolean isTicking() {
+ return getHandle().isTicking();
+ }
// Paper end
}