SPIGOT-5984: Add non deprecated / magic value way to set pixel in MapCanvas

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2022-06-09 21:27:39 +10:00
parent 0edbb16bb4
commit c67855f651

View file

@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.map;
import java.awt.Color;
import java.awt.Image;
import java.util.Arrays;
import org.bukkit.map.MapCanvas;
@ -35,6 +36,21 @@ public class CraftMapCanvas implements MapCanvas {
this.cursors = cursors;
}
@Override
public void setPixelColor(int x, int y, Color color) {
setPixel(x, y, MapPalette.matchColor(color));
}
@Override
public Color getPixelColor(int x, int y) {
return MapPalette.getColor(getPixel(x, y));
}
@Override
public Color getBasePixelColor(int x, int y) {
return MapPalette.getColor(getBasePixel(x, y));
}
@Override
public void setPixel(int x, int y, byte color) {
if (x < 0 || y < 0 || x >= 128 || y >= 128)