PaperMC/Spigot-Server-Patches/0573-Entity-isTicking.patch
Mariell Hoversholm 2db85c553f
fix: origin world can be unknown while knowing location
We will now store the world ID. It may not be used if the entity is
loaded before the world in question is, but it might be used later on,
should the entity come after the world.

Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-06-12 23:30:56 +01:00

42 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 48cbc44d5b502443be8205a6481d037f9fea491e..35b2e8dba3536febe997f3c562c56f0d5371a524 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;
@@ -3488,5 +3489,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
}