mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Use a dedicated thread to process world data (#1585)
This change allow low-end devices to join servers without timeout
This commit is contained in:
parent
3b5488a7bf
commit
9e5364a4ff
4 changed files with 43 additions and 13 deletions
|
|
@ -18,6 +18,7 @@ using System.Diagnostics;
|
|||
using MinecraftClient.Inventory.ItemPalettes;
|
||||
using MinecraftClient.Protocol.Handlers.PacketPalettes;
|
||||
using MinecraftClient.Logger;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MinecraftClient.Protocol.Handlers
|
||||
{
|
||||
|
|
@ -422,7 +423,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
int compressedDataSize = dataTypes.ReadNextInt(packetData);
|
||||
byte[] compressed = dataTypes.ReadData(compressedDataSize, packetData);
|
||||
byte[] decompressed = ZlibUtils.Decompress(compressed);
|
||||
pTerrain.ProcessChunkColumnData(chunkX, chunkZ, chunkMask, addBitmap, currentDimension == 0, chunksContinuous, currentDimension, new Queue<byte>(decompressed));
|
||||
new Task(new Action(() =>
|
||||
{
|
||||
pTerrain.ProcessChunkColumnData(chunkX, chunkZ, chunkMask, addBitmap, currentDimension == 0, chunksContinuous, currentDimension, new Queue<byte>(decompressed));
|
||||
})).Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -446,7 +450,10 @@ namespace MinecraftClient.Protocol.Handlers
|
|||
else dataTypes.ReadData(1024 * 4, packetData); // Biomes - 1.15 and above
|
||||
}
|
||||
int dataSize = dataTypes.ReadNextVarInt(packetData);
|
||||
pTerrain.ProcessChunkColumnData(chunkX, chunkZ, chunkMask, 0, false, chunksContinuous, currentDimension, packetData);
|
||||
new Task(new Action(() =>
|
||||
{
|
||||
pTerrain.ProcessChunkColumnData(chunkX, chunkZ, chunkMask, 0, false, chunksContinuous, currentDimension, packetData);
|
||||
})).Start();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue