palette does not always start with zero...

This commit is contained in:
DaPorkchop_ 2020-10-17 17:38:14 +02:00
parent a05abf0403
commit 3685d6b580
2 changed files with 2 additions and 3 deletions

View file

@ -10,7 +10,7 @@ public class ListPalette implements Palette {
private final int maxId; private final int maxId;
private final int[] data; private final int[] data;
private int nextId = 1; private int nextId = 0;
public ListPalette(int bitsPerEntry) { public ListPalette(int bitsPerEntry) {
this.maxId = (1 << bitsPerEntry) - 1; this.maxId = (1 << bitsPerEntry) - 1;

View file

@ -13,13 +13,12 @@ public class MapPalette implements Palette {
private final int[] idToState; private final int[] idToState;
private final IntObjectMap<Integer> stateToId = new IntObjectHashMap<>(); private final IntObjectMap<Integer> stateToId = new IntObjectHashMap<>();
private int nextId = 1; private int nextId = 0;
public MapPalette(int bitsPerEntry) { public MapPalette(int bitsPerEntry) {
this.maxId = (1 << bitsPerEntry) - 1; this.maxId = (1 << bitsPerEntry) - 1;
this.idToState = new int[this.maxId + 1]; this.idToState = new int[this.maxId + 1];
this.stateToId.put(0, (Integer) 0);
} }
@Override @Override