Skip to content

Commit 2d7db5f

Browse files
committed
[EntityCulling] Purge far away culled entities
1 parent 407250b commit 2d7db5f

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

bukkit/src/main/kotlin/io/github/rothes/esu/bukkit/module/networkthrottle/entityculling/UserCullData.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ class UserCullData(
8585
synchronized(hiddenEntities) {
8686
val raytraceHandler = raytraceHandler
8787
val iterator = hiddenEntities.int2ReferenceEntrySet().iterator()
88+
val playerLoc = player.location
8889
for (entry in iterator) {
8990
val entity = entry.value
9091
var flag = !raytraceHandler.isValid(entity)
91-
if (entity.world != player.world) {
92+
if (entity.world != player.world || entity.location.distanceSquared(playerLoc) > 1024 * 1024) {
9293
playerEntityVisibilityHandler.forceShowEntity(player, entity)
9394
flag = true
9495
}

0 commit comments

Comments
 (0)