Skip to content

Commit dd6297b

Browse files
committed
[EntityCulling] Force to skip culling players
1 parent 616080b commit dd6297b

File tree

1 file changed

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

1 file changed

+2
-3
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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ object RaytraceHandlerImpl: RaytraceHandler<RaytraceHandlerImpl.RaytraceConfig,
180180
/* Sort entities by tracking range */
181181
val entityTypeMap = Reference2ReferenceOpenHashMap<EntityType<*>, MutableList<Entity>>(ENTITY_TYPES)
182182
for (entity in entitiesRaw) {
183-
entity ?: continue
183+
if (entity == null || entity is ServerPlayer) continue // Skip players, bukkit api hides tab list too.
184184
val get = entityTypeMap.get(entity.type)
185185
if (get != null) get.add(entity)
186186
else entityTypeMap[entity.type] = ArrayList<Entity>(32).also { it.add(entity) }
@@ -308,7 +308,6 @@ object RaytraceHandlerImpl: RaytraceHandler<RaytraceHandlerImpl.RaytraceConfig,
308308
for ((trackRange, entities) in entities) {
309309
val maxRange = min(trackRange, viewDistanceSquared)
310310
for (entity in entities) {
311-
if (entity === player) continue
312311
val pos = entity.position()
313312
val dist = (playerX - pos.x).square() + (playerZ - pos.z).square()
314313
if (dist > maxRange) continue
@@ -638,7 +637,7 @@ object RaytraceHandlerImpl: RaytraceHandler<RaytraceHandlerImpl.RaytraceConfig,
638637
""")
639638
val entityCulledByDefault: Boolean = true,
640639
@Comment("These entity types are considered always visible.")
641-
val visibleEntityTypes: ReferenceSet<EntityType<*>> = ReferenceSet.of(EntityType.WITHER, EntityType.PLAYER),
640+
val visibleEntityTypes: ReferenceSet<EntityType<*>> = ReferenceSet.of(EntityType.WITHER),
642641
@Comment("Entities within this radius are considered always visible.")
643642
val forceVisibleDistance: Double = 8.0,
644643
@Comment("""

0 commit comments

Comments
 (0)