Skip to content

Commit cddcff7

Browse files
committed
[EntityCulling] Skip unloaded chunks
1 parent 22204af commit cddcff7

File tree

1 file changed

+2
-1
lines changed
  • bukkit/version/v1_18/src/main/kotlin/io/github/rothes/esu/bukkit/module/networkthrottle/entityculling/v1_18

1 file changed

+2
-1
lines changed

bukkit/version/v1_18/src/main/kotlin/io/github/rothes/esu/bukkit/module/networkthrottle/entityculling/v1_18/RaytraceHandlerImpl.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,8 @@ class RaytraceHandlerImpl: RaytraceHandler<RaytraceHandlerImpl.RaytraceConfig, E
412412

413413
if (chunkDiff or sectionDiff != 0) {
414414
if (chunkDiff != 0) {
415-
chunkSections = level.getChunk(newChunkX, newChunkZ).sections
415+
// If chunk is not loaded, consider blocked (Player should not see the entity either!)
416+
chunkSections = level.getChunkIfLoaded(newChunkX, newChunkZ)?.sections ?: return true
416417
}
417418
val sectionIndex = newChunkY - minSection
418419
if (sectionIndex !in (0 until chunkSections.size)) continue

0 commit comments

Comments
 (0)