From 3f487f4f4f9fc37096c9c96093e9513a547cd52f Mon Sep 17 00:00:00 2001 From: Felix Cravic Date: Sat, 5 Dec 2020 23:57:07 +0100 Subject: [PATCH] Entity with scheduled removal still execute tick until complete removal, added some comments --- src/main/java/net/minestom/server/entity/Entity.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/minestom/server/entity/Entity.java b/src/main/java/net/minestom/server/entity/Entity.java index 0af415975..f97f58346 100644 --- a/src/main/java/net/minestom/server/entity/Entity.java +++ b/src/main/java/net/minestom/server/entity/Entity.java @@ -384,21 +384,23 @@ public abstract class Entity implements Viewable, EventHandler, DataContainer, P if (instance == null) return; - if (scheduledRemoveTime != 0) { // Any entity with scheduled remove does not update + // Scheduled remove + if (scheduledRemoveTime != 0) { final boolean finished = time >= scheduledRemoveTime; if (finished) { remove(); + return; } - return; } + // Instant remove if (shouldRemove()) { remove(); return; } - final Chunk currentChunk = getChunk(); // current entity chunk - + // Check if the entity chunk is loaded + final Chunk currentChunk = getChunk(); if (!ChunkUtils.isLoaded(currentChunk)) { // No update for entities in unloaded chunk return;