Skip to content

Commit faa6965

Browse files
committed
Fix reading the wrong block if palette only has one entry
1 parent 3243c0c commit faa6965

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil113.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ public int getSectionY() {
194194
}
195195

196196
public BlockState getBlockState(int x, int y, int z) {
197+
if (palette.length == 1) return palette[0];
197198
if (blocks.length == 0) return BlockState.AIR;
198199

199200
x &= 0xF; y &= 0xF; z &= 0xF; // Math.floorMod(pos.getX(), 16)

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil115.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ public int getSectionY() {
196196
}
197197

198198
public BlockState getBlockState(int x, int y, int z) {
199+
if (palette.length == 1) return palette[0];
199200
if (blocks.length == 0) return BlockState.AIR;
200201

201202
x &= 0xF; y &= 0xF; z &= 0xF; // Math.floorMod(pos.getX(), 16)

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil116.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ public int getSectionY() {
230230
}
231231

232232
public BlockState getBlockState(int x, int y, int z) {
233-
if (blocks.length == 0) return BlockState.AIR;
234233
if (palette.length == 1) return palette[0];
234+
if (blocks.length == 0) return BlockState.AIR;
235235

236236
x &= 0xF; y &= 0xF; z &= 0xF; // Math.floorMod(pos.getX(), 16)
237237

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/mca/ChunkAnvil118.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ public int getSectionY() {
231231
}
232232

233233
public BlockState getBlockState(int x, int y, int z) {
234-
if (blocks.length == 0) return BlockState.AIR;
235234
if (blockPalette.length == 1) return blockPalette[0];
235+
if (blocks.length == 0) return BlockState.AIR;
236236

237237
x &= 0xF; y &= 0xF; z &= 0xF; // Math.floorMod(pos.getX(), 16)
238238

0 commit comments

Comments
 (0)