Paper/patches/server/0501-Entity-isTicking.patch

43 lines
1.9 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02: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
2022-06-08 15:38:56 +02:00
index b649331eb5e1a94d4d9c4bc16f17c7abdf25e417..abff005638997cc991bc7e7c5fd98c91d8f076cf 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
2022-06-08 08:06:17 +02:00
@@ -58,6 +58,7 @@ import net.minecraft.resources.ResourceKey;
2021-06-14 16:41:34 +02:00
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MCUtil;
2021-06-11 14:02:28 +02:00
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;
2022-06-08 15:38:56 +02:00
@@ -4041,5 +4042,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
2021-06-11 14:02:28 +02:00
public static int nextEntityId() {
return ENTITY_COUNTER.incrementAndGet();
}
+
+ public boolean isTicking() {
2021-06-14 17:17:08 +02:00
+ return ((ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
2021-06-11 14:02:28 +02: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
2022-06-08 08:06:17 +02:00
index a16f343864e87dfe768e2697d6834a0244ba49b1..fefd03ffe3c1b4dbdf3035e80d5a00ef2fd6e670 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
2022-06-08 08:06:17 +02:00
@@ -1278,5 +1278,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
2021-06-11 14:02:28 +02:00
public boolean isInLava() {
return getHandle().isInLava();
}
+
+ public boolean isTicking() {
+ return getHandle().isTicking();
+ }
// Paper end
}