File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
bukkit/src/main/kotlin/io/github/rothes/esu/bukkit/module/networkthrottle/entityculling Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import io.github.rothes.esu.bukkit.util.scheduler.Scheduler
77import io.github.rothes.esu.bukkit.util.version.Versioned
88import io.github.rothes.esu.bukkit.util.version.adapter.PlayerAdapter.Companion.connected
99import io.github.rothes.esu.bukkit.util.version.adapter.TickThreadAdapter.Companion.checkTickThread
10+ import io.github.rothes.esu.core.util.extension.math.square
1011import it.unimi.dsi.fastutil.Hash
1112import it.unimi.dsi.fastutil.ints.Int2ReferenceOpenHashMap
1213import it.unimi.dsi.fastutil.ints.IntArrayList
@@ -89,7 +90,8 @@ class UserCullData(
8990 for (entry in iterator) {
9091 val entity = entry.value
9192 var flag = ! raytraceHandler.isValid(entity)
92- if (entity.world != player.world || entity.location.distanceSquared(playerLoc) > 1024 * 1024 ) {
93+ val loc = entity.location
94+ if (loc.world != playerLoc.world || (playerLoc.x - loc.x).square() + (playerLoc.z - loc.z).square() > 1024 * 1024 ) {
9395 playerEntityVisibilityHandler.forceShowEntity(player, entity)
9496 flag = true
9597 }
You can’t perform that action at this time.
0 commit comments