Biome palettes entries can have 1 bit

This commit is contained in:
Nassim Jahnke 2021-09-16 15:47:28 +02:00
parent 5a90c8374c
commit 111cd2fd46
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -89,7 +89,8 @@ public final class PaletteType1_18 extends PartialType<DataPalette, PaletteType>
public void write(final ByteBuf buffer, final PaletteType type, final DataPalette palette) throws Exception { public void write(final ByteBuf buffer, final PaletteType type, final DataPalette palette) throws Exception {
int bitsPerValue; int bitsPerValue;
if (palette.size() > 1) { if (palette.size() > 1) {
bitsPerValue = type == PaletteType.BLOCKS ? 4 : 2; //TODO implement linear palette // 1, 2, and 3 bit linear palettes can't be read by the client
bitsPerValue = type == PaletteType.BLOCKS ? 4 : 1;
while (palette.size() > 1 << bitsPerValue) { while (palette.size() > 1 << bitsPerValue) {
bitsPerValue += 1; bitsPerValue += 1;
} }