Fix palette size when filling to 0

This commit is contained in:
themode 2022-01-04 00:48:34 +01:00 committed by TheMode
parent d4eaeffb30
commit 4c31d73bbf
2 changed files with 11 additions and 1 deletions

View File

@ -147,7 +147,7 @@ final class PaletteImpl implements Palette, Cloneable {
block |= (long) value << i * bitsPerEntry;
}
Arrays.fill(values, block);
this.count = maxSize();
this.count = placedAir ? 0 : maxSize();
}
@Override

View File

@ -96,6 +96,16 @@ public class PaletteTest {
}
}
}
palette.fill(0);
assertEquals(0, palette.size());
for (int y = 0; y < palette.dimension(); y++) {
for (int x = 0; x < palette.dimension(); x++) {
for (int z = 0; z < palette.dimension(); z++) {
assertEquals(0, palette.get(x, y, z));
}
}
}
}
}