Paper/Spigot-Server-Patches/0575-Entity-isTicking.patch

43 Zeilen
1.9 KiB
Diff

2020-10-04 05:05:33 +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
2021-03-16 14:04:28 +01:00
index 1b3371b087efa8c184f3c07fe560a709f76db4f7..80f3e124ad6230789e27e8ddf20be08befb0a86f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
2021-03-16 14:04:28 +01:00
@@ -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;
@@ -3478,5 +3479,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
2020-10-04 05:05:33 +02:00
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 e0ab4c96544483e43c7f5e5f5965f74a207437d5..c064c510442d615beeacf9899d9b7f0e10ce7575 100644
2020-10-04 05:05:33 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1157,5 +1157,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
2020-10-04 05:05:33 +02:00
public boolean isInLava() {
return getHandle().isInLava();
}
+
+ public boolean isTicking() {
+ return getHandle().isTicking();
+ }
// Paper end
}