Send area broadcasted packets in batches

- I don't know why it wasn't done like this to start with
- This provides a significant lightening of workload for large servers with lots of players in the same area because packets are only compressed once instead of for each player.
- Improves client-sided performance receiving these in batches instead of being spammed with many individual packets.
This commit is contained in:
Dylan K. Taylor 2017-06-05 23:39:16 +01:00
parent c6e800cf42
commit 29e88d8592

View File

@ -786,9 +786,7 @@ class Level implements ChunkManager, Metadatable{
Level::getXZ($index, $chunkX, $chunkZ);
$chunkPlayers = $this->getChunkPlayers($chunkX, $chunkZ);
if(count($chunkPlayers) > 0){
foreach($entries as $pk){
$this->server->broadcastPacket($chunkPlayers, $pk);
}
$this->server->batchPackets($chunkPlayers, $entries, false, false);
}
}