Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
fix setPaletteEntry
Dieser Commit ist enthalten in:
Ursprung
fd1932cfd8
Commit
c8a19a1d83
@ -92,8 +92,18 @@ public class ChunkSection {
|
||||
|
||||
public void setPaletteEntry(int index, int id) {
|
||||
if (index < 0 || index >= palette.size()) throw new IndexOutOfBoundsException();
|
||||
palette.set(index, id);
|
||||
int oldId = palette.set(index, id);
|
||||
if (oldId == id) return;
|
||||
inversePalette.put(id, index);
|
||||
if (inversePalette.get(oldId) == index) {
|
||||
inversePalette.remove(oldId);
|
||||
for (int i = 0; i < palette.size(); i++) {
|
||||
if (palette.get(i) == oldId) {
|
||||
inversePalette.put(oldId, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void replacePaletteEntry(int oldId, int newId) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren