Skip to content
Permalink
Browse files

Remove and send new custom blocks after sending LevelBegin packet.

This takes advantage of the fact ClassicalSharp can skip performing relatively expensive operations like refreshing lighting and refreshing chunks in the map, when the map is not in 'loaded' state
  • Loading branch information...
UnknownShadow200 committed Jul 21, 2017
1 parent 9d33ff1 commit dee665bf1576d33aaf20c3831013d11390821318
Showing with 8 additions and 6 deletions.
  1. +8 −6 fCraft/Network/Player.Networking.cs
@@ -1102,18 +1102,20 @@ bool LoginSequence()
if (oldWorld != null) {
SendNow(Packet.MakeHandshake(this, textLine1, textLine2, HasCP437));
}
// needs to be sent before the client receives the map data
if (Supports(CpeExt.BlockDefinitions)) {
if (oldWorld != null)
BlockDefinition.SendNowRemoveOldBlocks(this, oldWorld);
BlockDefinition.SendNowBlocks(this);
}

if (Supports(CpeExt.BlockPermissions))
SendBlockPermissions();

writer.Write(OpCode.MapBegin);
BytesSent++;

if (Supports(CpeExt.BlockDefinitions)) {
if (oldWorld != null) {
BlockDefinition.SendNowRemoveOldBlocks(this, oldWorld);
}
BlockDefinition.SendNowBlocks(this);
}

// enable Nagle's algorithm (in case it was turned off by LowLatencyMode)
// to avoid wasting bandwidth for map transfer
client.NoDelay = false;

0 comments on commit dee665b

Please sign in to comment.
You can’t perform that action at this time.