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

37 lines
1.6 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
index 8f103dc563110f04563487f90fe02de4288a99a7..20289623062acd34afb0ca5fc7daaf032ec1f418 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
@@ -4739,5 +4739,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
2021-06-11 14:02:28 +02:00
public static int nextEntityId() {
return ENTITY_COUNTER.incrementAndGet();
}
+
+ public boolean isTicking() {
+ return ((net.minecraft.server.level.ServerLevel) this.level).isPositionEntityTicking(this.blockPosition());
2021-06-11 14:02:28 +02:00
+ }
// Paper end - Expose entity id counter
2021-06-11 14:02:28 +02:00
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 609c768ba4d22e346acbc9422ce41e3b887fadb1..dbb1a52b1e5871bbb1ccbd300b8edb9aa0f56e49 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
@@ -1058,4 +1058,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
2021-06-11 14:02:28 +02:00
return getHandle().isInLava();
}
// Paper end - entity liquid API
2021-06-11 14:02:28 +02:00
+
+ // Paper start - isTicking API
2022-10-11 14:43:10 +02:00
+ @Override
2021-06-11 14:02:28 +02:00
+ public boolean isTicking() {
+ return getHandle().isTicking();
+ }
+ // Paper end - isTicking API
2021-06-11 14:02:28 +02:00
}