Fix reading the wrong block if palette only has one entry

This commit is contained in:
Lukas Rieger (Blue) 2022-10-21 20:18:25 +02:00
parent 3243c0c36e
commit faa6965df3
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
4 changed files with 4 additions and 2 deletions

View File

@ -194,6 +194,7 @@ public class ChunkAnvil113 extends MCAChunk {
}
public BlockState getBlockState(int x, int y, int z) {
if (palette.length == 1) return palette[0];
if (blocks.length == 0) return BlockState.AIR;
x &= 0xF; y &= 0xF; z &= 0xF; // Math.floorMod(pos.getX(), 16)

View File

@ -196,6 +196,7 @@ public class ChunkAnvil115 extends MCAChunk {
}
public BlockState getBlockState(int x, int y, int z) {
if (palette.length == 1) return palette[0];
if (blocks.length == 0) return BlockState.AIR;
x &= 0xF; y &= 0xF; z &= 0xF; // Math.floorMod(pos.getX(), 16)

View File

@ -230,8 +230,8 @@ public class ChunkAnvil116 extends MCAChunk {
}
public BlockState getBlockState(int x, int y, int z) {
if (blocks.length == 0) return BlockState.AIR;
if (palette.length == 1) return palette[0];
if (blocks.length == 0) return BlockState.AIR;
x &= 0xF; y &= 0xF; z &= 0xF; // Math.floorMod(pos.getX(), 16)

View File

@ -231,8 +231,8 @@ public class ChunkAnvil118 extends MCAChunk {
}
public BlockState getBlockState(int x, int y, int z) {
if (blocks.length == 0) return BlockState.AIR;
if (blockPalette.length == 1) return blockPalette[0];
if (blocks.length == 0) return BlockState.AIR;
x &= 0xF; y &= 0xF; z &= 0xF; // Math.floorMod(pos.getX(), 16)