Fix flexible palette out of bounds

(cherry picked from commit 5afce81de5)
This commit is contained in:
iam4722202468 2023-05-28 14:29:55 -04:00 committed by Matt Worzala
parent 912fb34f17
commit 7b7f0308aa

View File

@ -240,7 +240,7 @@ final class FlexiblePalette implements SpecializedPalette, Cloneable {
final int y = index >> shiftedDimensionBitCount;
final int z = index >> dimensionBitCount & dimensionMinus;
final int x = index & dimensionMinus;
final int result = ids != null ? ids[paletteIndex] : paletteIndex;
final int result = ids != null && paletteIndex < ids.length ? ids[paletteIndex] : paletteIndex;
consumer.accept(x, y, z, result);
}
}