Return constant empty set if the chunk is not loaded

This commit is contained in:
TheMode 2021-04-14 22:29:38 +02:00
parent 90211ddf50
commit 250907df6c

View File

@ -488,7 +488,7 @@ public abstract class Instance implements BlockModifier, Tickable, EventHandler,
*/
public @NotNull Set<Entity> getChunkEntities(Chunk chunk) {
if (!ChunkUtils.isLoaded(chunk))
return new HashSet<>();
return Collections.emptySet();
final long index = ChunkUtils.getChunkIndex(chunk.getChunkX(), chunk.getChunkZ());
final Set<Entity> entities = getEntitiesInChunk(index);