Correctly calculate the number of bits-per block for 1.16-chunks

This commit is contained in:
Blue (Lukas Rieger) 2020-08-30 00:56:54 +02:00
parent 0aa69c7591
commit 63d00073c5
3 changed files with 3 additions and 5 deletions

View File

@ -184,7 +184,7 @@ public class ChunkAnvil113 extends Chunk {
this.palette = new BlockState[0];
}
this.bitsPerBlock = blocks.length * 64 / 4096; //64 bits per long and 4096 blocks per section
this.bitsPerBlock = this.blocks.length >> 6; // available longs * 64 (bits per long) / 4096 (blocks per section) (floored result)
}
public int getSectionY() {

View File

@ -185,7 +185,7 @@ public class ChunkAnvil115 extends Chunk {
this.palette = new BlockState[0];
}
this.bitsPerBlock = blocks.length * 64 / 4096; //64 bits per long and 4096 blocks per section
this.bitsPerBlock = this.blocks.length >> 6; // available longs * 64 (bits per long) / 4096 (blocks per section) (floored result)
}
public int getSectionY() {

View File

@ -185,9 +185,7 @@ public class ChunkAnvil116 extends Chunk {
this.palette = new BlockState[0];
}
this.bitsPerBlock = 32 - Integer.numberOfLeadingZeros(palette.length - 1);
if (this.bitsPerBlock < 4) this.bitsPerBlock = 4;
this.bitsPerBlock = this.blocks.length >> 6; // available longs * 64 (bits per long) / 4096 (blocks per section) (floored result)
}
public int getSectionY() {