*Actually important Microoptimization*

Anything that handles every single connected player should be optimized
This commit is contained in:
LeoDog896 2021-01-15 13:05:21 -05:00
parent 3536bdc856
commit 12adb9a965

View File

@ -476,9 +476,7 @@ public final class MinecraftServer {
MinecraftServer.chunkViewDistance = chunkViewDistance; MinecraftServer.chunkViewDistance = chunkViewDistance;
if (started) { if (started) {
final Collection<Player> players = connectionManager.getOnlinePlayers(); for (final Player player : connectionManager.getOnlinePlayers()) {
players.forEach(player -> {
final Chunk playerChunk = player.getChunk(); final Chunk playerChunk = player.getChunk();
if (playerChunk != null) { if (playerChunk != null) {
@ -512,12 +510,12 @@ public final class MinecraftServer {
"The entity view distance must be between 0 and 32"); "The entity view distance must be between 0 and 32");
MinecraftServer.entityViewDistance = entityViewDistance; MinecraftServer.entityViewDistance = entityViewDistance;
if (started) { if (started) {
connectionManager.getOnlinePlayers().forEach(player -> { for (final Player player : connectionManager.getOnlinePlayers()) {
final Chunk playerChunk = player.getChunk(); final Chunk playerChunk = player.getChunk();
if (playerChunk != null) { if (playerChunk != null) {
player.refreshVisibleEntities(playerChunk); player.refreshVisibleEntities(playerChunk);
} }
}); }
} }
} }