mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-26 02:57:37 +01:00
Bring back palette optimization
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
fbd462a6ee
commit
6716b21a4a
@ -123,10 +123,14 @@ final class AdaptivePalette implements Palette {
|
|||||||
if (currentPalette instanceof FlexiblePalette flexiblePalette) {
|
if (currentPalette instanceof FlexiblePalette flexiblePalette) {
|
||||||
final int count = flexiblePalette.count();
|
final int count = flexiblePalette.count();
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
currentPalette = new FilledPalette(dimension, 0);
|
return (this.palette = new FilledPalette(dimension, 0));
|
||||||
this.palette = currentPalette;
|
} else if (count == flexiblePalette.maxSize()) {
|
||||||
|
var palette = flexiblePalette.paletteToValueList;
|
||||||
|
if (palette.size() == 2 && palette.getInt(0) == 0) {
|
||||||
|
// first element is air, second should be the value the palette is filled with
|
||||||
|
return (this.palette = new FilledPalette(dimension, palette.getInt(1)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO optimize the case where the palette is filled with a single value
|
|
||||||
}
|
}
|
||||||
return currentPalette;
|
return currentPalette;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user