mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 12:05:14 -04:00
turns out GZipStream.ReadByte() allocates a 1 byte array each time, so avoid that
This commit is contained in:
parent
39fa4279d3
commit
a13c673d5f
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user