From 331d1ed71c87048e2a9a285223375a8d4036ae7e Mon Sep 17 00:00:00 2001 From: BillyGalbreath Date: Sat, 3 Oct 2020 22:05:33 -0500 Subject: [PATCH] Entity#isTicking (#4612) --- Spigot-API-Patches/Entity-isTicking.patch | 21 ++++++++++++ Spigot-Server-Patches/Entity-isTicking.patch | 34 ++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 Spigot-API-Patches/Entity-isTicking.patch create mode 100644 Spigot-Server-Patches/Entity-isTicking.patch diff --git a/Spigot-API-Patches/Entity-isTicking.patch b/Spigot-API-Patches/Entity-isTicking.patch new file mode 100644 index 0000000000..7cab16fc87 --- /dev/null +++ b/Spigot-API-Patches/Entity-isTicking.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -0,0 +0,0 @@ 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 + } diff --git a/Spigot-Server-Patches/Entity-isTicking.patch b/Spigot-Server-Patches/Entity-isTicking.patch new file mode 100644 index 0000000000..66a5f91584 --- /dev/null +++ b/Spigot-Server-Patches/Entity-isTicking.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { + public boolean isInLava() { + return getHandle().isInLava(); + } ++ ++ public boolean isTicking() { ++ return getHandle().isTicking(); ++ } + // Paper end + }