turns out GZipStream.ReadByte() allocates a 1 byte array each time, so avoid that

This commit is contained in:
UnknownShadow200 2017-09-20 14:49:00 +10:00
parent 39fa4279d3
commit a13c673d5f

View File

@ -48,12 +48,14 @@ namespace ClassicalSharp.Map {
void ReadCustomBlocks(Stream s, int width, int height, int length, byte[] blocks) {
byte[] chunk = new byte[16 * 16 * 16];
byte[] data = new byte[1];
for (int y = 0; y < height; y += 16)
for (int z = 0; z < length; z += 16)
for (int x = 0; x < width; x += 16)
{
if (s.ReadByte() != 1) continue;
int read = s.Read(data, 0, 1);
if (read == 0 || data[0] != 1) continue;
s.Read(chunk, 0, chunk.Length);
int baseIndex = (y * length + z) * width + x;