Fix possible NPE in 1.17->1.16.4 bedrock at 0 emulation (#821)

This commit is contained in:
EnZaXD 2024-07-14 10:10:03 +02:00 committed by GitHub
parent 7e08534f4f
commit c9d57aab8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -364,10 +364,12 @@ public final class BlockItemPacketRewriter1_17 extends BackwardsItemRewriter<Cli
if (ViaBackwards.getConfig().bedrockAtY0()) {
final ChunkSection lowestSection = chunk.getSections()[0];
final DataPalette blocks = lowestSection.palette(PaletteType.BLOCKS);
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
blocks.setIdAt(x, 0, z, BEDROCK_BLOCK_STATE);
if (lowestSection != null) {
final DataPalette blocks = lowestSection.palette(PaletteType.BLOCKS);
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
blocks.setIdAt(x, 0, z, BEDROCK_BLOCK_STATE);
}
}
}
}