Skip to content

Commit 6fbaca5

Browse files
committed
[EntityCulling] visibleEntityTypes uses ReferenceSet, remove ENDER_DRAGON from default set cuz never affect boss-bar
1 parent ccd0ba1 commit 6fbaca5

File tree

1 file changed

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

1 file changed

+2
-5
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import io.github.rothes.esu.core.util.extension.math.square
2929
import it.unimi.dsi.fastutil.ints.Int2ReferenceOpenHashMap
3030
import it.unimi.dsi.fastutil.ints.IntArrayList
3131
import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap
32+
import it.unimi.dsi.fastutil.objects.ReferenceSet
3233
import kotlinx.coroutines.*
3334
import net.minecraft.server.level.ServerLevel
3435
import net.minecraft.server.level.ServerPlayer
@@ -277,9 +278,6 @@ object RaytraceHandlerImpl: RaytraceHandler<RaytraceHandlerImpl.RaytraceConfig,
277278
val playerY = player.y
278279
val playerZ = player.z
279280

280-
val playerGridX = playerX.floorI() shr 8
281-
val playerGridZ = playerZ.floorI() shr 8
282-
283281
val shouldCull = userCullData.shouldCull
284282
val predicatedPlayerPos = if (shouldCull && config.predicatePlayerPositon) {
285283
val velocity = playerVelocityGetter.getPlayerMoveVelocity(player)
@@ -316,7 +314,6 @@ object RaytraceHandlerImpl: RaytraceHandler<RaytraceHandlerImpl.RaytraceConfig,
316314
if (dist > maxRange) continue
317315

318316
tickedEntities++
319-
320317
if (
321318
!shouldCull
322319
|| dist + (playerY - pos.y).square() <= forceVisibleDistanceSquared
@@ -632,7 +629,7 @@ object RaytraceHandlerImpl: RaytraceHandler<RaytraceHandlerImpl.RaytraceConfig,
632629
""")
633630
val entityCulledByDefault: Boolean = true,
634631
@Comment("These entity types are considered always visible.")
635-
val visibleEntityTypes: Set<EntityType<*>> = setOf(EntityType.WITHER, EntityType.ENDER_DRAGON, EntityType.PLAYER),
632+
val visibleEntityTypes: ReferenceSet<EntityType<*>> = ReferenceSet.of(EntityType.WITHER, EntityType.PLAYER),
636633
@Comment("Entities within this radius are considered always visible.")
637634
val forceVisibleDistance: Double = 8.0,
638635
@Comment("""

0 commit comments

Comments
 (0)