Entity#isTicking (#4612)

This commit is contained in:
BillyGalbreath 2020-10-03 22:05:33 -05:00 committed by GitHub
parent f1997241b4
commit 5234e6e242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sat, 3 Oct 2020 21:39:07 -0500
Subject: [PATCH] Entity#isTicking
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index cb9ef706eeb994f1948708ad5e8689550ea56df7..9bae4704b306b1d04534072690355983856c7801 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -690,5 +690,10 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
* Check if entity is in lava
*/
public boolean isInLava();
+
+ /**
+ * Check if entity is inside a ticking chunk
+ */
+ public boolean isTicking();
// Paper end
}

View File

@ -0,0 +1,34 @@
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/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ebdbbeb1b55b428dde3ab1c9691cb153c6c2fe76..28e2d3f0a5e2ab084175bf0bba88816f80089799 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -3379,5 +3379,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
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 6ceb2d50c59b63a337364605f8a5280d905f2662..6f59f8d4541451573eb50a1a3190788c51490502 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1121,5 +1121,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean isInLava() {
return getHandle().isInLava();
}
+
+ public boolean isTicking() {
+ return getHandle().isTicking();
+ }
// Paper end
}