diff --git a/src/main/java/net/minestom/server/instance/EntityTrackerImpl.java b/src/main/java/net/minestom/server/instance/EntityTrackerImpl.java index 1480e1356..5e96f597f 100644 --- a/src/main/java/net/minestom/server/instance/EntityTrackerImpl.java +++ b/src/main/java/net/minestom/server/instance/EntityTrackerImpl.java @@ -112,12 +112,9 @@ final class EntityTrackerImpl implements EntityTracker { @Override public void nearbyEntities(@NotNull Point point, double range, @NotNull Target target, @NotNull Consumer query) { final TargetEntry entry = entries[target.ordinal()]; - final int chunkRange; - // No need to loop through neighbor chunk if the point is a chunk coordinate - if (point.x() % 16 == 0 && point.z() % 16 == 0) { - chunkRange = (int) (range / Chunk.CHUNK_SECTION_SIZE); - } else { - chunkRange = (int) (range / Chunk.CHUNK_SECTION_SIZE) + 1; + int chunkRange = (int) (range / Chunk.CHUNK_SECTION_SIZE); + if (point.x() % 16 != 0 || point.z() % 16 != 0) { + chunkRange++; // Need to loop through surrounding chunks to properly support borders } // Loop through range if (range % 16 == 0) {