Class MapPalette

java.lang.Object
org.bukkit.map.MapPalette

public final class MapPalette extends Object
Represents the palette that map items use.

These fields are the base color ranges. Each entry corresponds to four colors of varying shades with values entry to entry + 3.

Since:
1.0.0
  • Field Details

  • Method Details

    • resizeImage

      @NotNull public static @NotNull BufferedImage resizeImage(@Nullable @Nullable Image image)
      Resize an image to 128x128.
      Parameters:
      image - The image to resize.
      Returns:
      The resized image.
      Since:
      1.0.0
    • imageToBytes

      @Deprecated(since="1.6.2", forRemoval=true) @NotNull public static @NotNull byte[] imageToBytes(@NotNull @NotNull Image image)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use color-related methods
      Convert an Image to a byte[] using the palette.
      Parameters:
      image - The image to convert.
      Returns:
      A byte[] containing the pixels of the image.
    • matchColor

      @Deprecated(since="1.6.2", forRemoval=true) public static byte matchColor(int r, int g, int b)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use color-related methods
      Get the index of the closest matching color in the palette to the given color.
      Parameters:
      r - The red component of the color.
      g - The green component of the color.
      b - The blue component of the color.
      Returns:
      The index in the palette.
    • matchColor

      @Deprecated(since="1.6.2", forRemoval=true) public static byte matchColor(@NotNull @NotNull Color color)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use color-related methods
      Get the index of the closest matching color in the palette to the given color.
      Parameters:
      color - The Color to match.
      Returns:
      The index in the palette.
    • getColor

      @Deprecated(since="1.6.2", forRemoval=true) @NotNull public static @NotNull Color getColor(byte index)
      Deprecated, for removal: This API element is subject to removal in a future version.
      use color directly
      Get the value of the given color in the palette.
      Parameters:
      index - The index in the palette.
      Returns:
      The Color of the palette entry.
    • getNearestColor

      @NotNull public static @NotNull Color getNearestColor(@NotNull @NotNull Color color)
      Gets the closest Color in the map palette.
      Parameters:
      color - to match against the map palette
      Returns:
      the nearest Color from the map palette
      Since:
      1.21.10
    • setMapColorCache

      public static void setMapColorCache(@NotNull @NotNull MapPalette.MapColorCache mapColorCache)
      Sets the given MapColorCache.
      Parameters:
      mapColorCache - The map color cache to set
      Since:
      1.19