From c67855f6516fd075302f3a72332730f150978df6 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 9 Jun 2022 21:27:39 +1000 Subject: [PATCH] SPIGOT-5984: Add non deprecated / magic value way to set pixel in MapCanvas By: DerFrZocker --- .../bukkit/craftbukkit/map/CraftMapCanvas.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java b/paper-server/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java index 7a7922bb19..73c4fdaee8 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/map/CraftMapCanvas.java @@ -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)