mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-08 03:40:27 +01:00
Stricter resize rule
This commit is contained in:
parent
8839503767
commit
487fbcb5b9
@ -126,11 +126,12 @@ final class AdaptivePalette implements Palette {
|
||||
// Find all entries and compress the palette
|
||||
IntSet entries = new IntOpenHashSet(flexiblePalette.paletteToValueList.size());
|
||||
flexiblePalette.getAll((x, y, z, value) -> entries.add(value));
|
||||
final int currentBitsPerEntry = flexiblePalette.bitsPerEntry();
|
||||
final int bitsPerEntry;
|
||||
if (entries.size() == 1) {
|
||||
return new FilledPalette(dimension, entries.iterator().nextInt());
|
||||
} else if (flexiblePalette.bitsPerEntry() > defaultBitsPerEntry) {
|
||||
final int bitsPerEntry = MathUtils.bitsToRepresent(entries.size() - 1);
|
||||
assert bitsPerEntry < flexiblePalette.bitsPerEntry();
|
||||
} else if (currentBitsPerEntry > defaultBitsPerEntry &&
|
||||
(bitsPerEntry = MathUtils.bitsToRepresent(entries.size() - 1)) < currentBitsPerEntry) {
|
||||
flexiblePalette.resize(bitsPerEntry);
|
||||
return flexiblePalette;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user