mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-30 03:51:20 +01:00
Remove reset of values from PaletteIndirect (#2590)
* Remove reset of values from PaletteIndirect * Add test for PaletteIndirect constructor
This commit is contained in:
parent
6f107c7f88
commit
c1a3ee6aca
@ -49,8 +49,6 @@ final class PaletteIndirect implements SpecializedPalette, Cloneable {
|
|||||||
this.paletteToValueList.add(palette[i]);
|
this.paletteToValueList.add(palette[i]);
|
||||||
this.valueToPaletteMap.put(palette[i], i);
|
this.valueToPaletteMap.put(palette[i], i);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.values = new long[arrayLength(dimension(), bitsPerEntry)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PaletteIndirect(int dimension, int maxBitsPerEntry, byte bitsPerEntry) {
|
PaletteIndirect(int dimension, int maxBitsPerEntry, byte bitsPerEntry) {
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package net.minestom.server.instance.palette;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class PaletteIndirectTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void constructor() {
|
||||||
|
var palette = new PaletteIndirect(16, 8, (byte) 4);
|
||||||
|
palette.set(0, 0, 1, 1);
|
||||||
|
var otherPalette = new PaletteIndirect(palette.dimension(), palette.maxBitsPerEntry(), (byte) palette.bitsPerEntry(), palette.count(), palette.paletteToValueList.toIntArray(), palette.values);
|
||||||
|
|
||||||
|
palette.getAll((x, y, z, value) -> {
|
||||||
|
assert value == otherPalette.get(x, y, z);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user