SPIGOT-7138: Can't retrieve pixel color from map

This commit is contained in:
DerFrZocker 2022-08-16 19:38:09 +10:00 committed by md_5
parent ead719a65b
commit f80adb8b9f
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -38,12 +38,17 @@ public class CraftMapCanvas implements MapCanvas {
@Override @Override
public void setPixelColor(int x, int y, Color color) { public void setPixelColor(int x, int y, Color color) {
setPixel(x, y, MapPalette.matchColor(color)); setPixel(x, y, (color == null) ? -1 : MapPalette.matchColor(color));
} }
@Override @Override
public Color getPixelColor(int x, int y) { public Color getPixelColor(int x, int y) {
return MapPalette.getColor(getPixel(x, y)); byte pixel = getPixel(x, y);
if (pixel == -1) {
return null;
}
return MapPalette.getColor(pixel);
} }
@Override @Override