From 31110aa3d45d0ebe835cf1dae063c15c752833ce Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 28 Jul 2016 11:52:31 +1000 Subject: [PATCH] Minor performance optimisation for sending level in classic+hax mode. --- Network/Player.Networking.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Network/Player.Networking.cs b/Network/Player.Networking.cs index 8bc0290c3..cbbfedb20 100644 --- a/Network/Player.Networking.cs +++ b/Network/Player.Networking.cs @@ -392,9 +392,12 @@ namespace MCGalaxy { byte* convCPE = stackalloc byte[256]; for (int i = 0; i < 256; i++) conv[i] = Block.Convert((byte)i); + if (!hasCustomBlocks) { - for (int i = 0; i < 256; i++) + for (int i = 0; i < 256; i++) { convCPE[i] = Block.ConvertCPE((byte)i); + conv[i] = Block.ConvertCPE(conv[i]); + } } using (GZipStream compressor = new GZipStream(dst, CompressionMode.Compress, true)) { @@ -425,7 +428,7 @@ namespace MCGalaxy { block = hasBlockDefs ? level.GetExtTile(i) : level.GetFallbackExtTile(i); buffer[bIndex] = convCPE[block]; } else { - buffer[bIndex] = convCPE[conv[block]]; + buffer[bIndex] = conv[block]; } bIndex++;