Handle bad heightmaps in 1.17->1.16.4 (#743)

This commit is contained in:
EnZaXD 2024-05-09 21:56:14 +02:00 committed by GitHub
parent 6292c5a5a5
commit 1a22b371cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -339,6 +339,10 @@ public final class BlockItemPackets1_17 extends BackwardsItemRewriter<Clientboun
CompoundTag heightMaps = chunk.getHeightMap();
for (Tag heightMapTag : heightMaps.values()) {
if (!(heightMapTag instanceof LongArrayTag)) {
continue; // Client can handle bad data
}
LongArrayTag heightMap = (LongArrayTag) heightMapTag;
int[] heightMapData = new int[256];
int bitsPerEntry = MathUtil.ceilLog2((currentWorldSectionHeight << 4) + 1);