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 hee base color ranges. Each entry corresponds to four colors of varying shades with values entry to entry + 3.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Holds cached information for matching map colors of a given RBG color.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
    static final @NotNull Color[]
     
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
    static final byte
    Deprecated.
    Magic value
  • Method Summary

    Modifier and Type
    Method
    Description
    getColor(byte index)
    Deprecated, for removal: This API element is subject to removal in a future version.
    use color directly
    static @org.jetbrains.annotations.NotNull byte[]
    Deprecated, for removal: This API element is subject to removal in a future version.
    use color-related methods
    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
    static byte
    Deprecated, for removal: This API element is subject to removal in a future version.
    use color-related methods
    Resize an image to 128x128.
    static void
    Sets the given MapColorCache.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.
    • imageToBytes

      @Deprecated(forRemoval=true, since="1.20.2") @NotNull public static @org.jetbrains.annotations.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(forRemoval=true, since="1.20.2") 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.
      b - The blue component of the color.
      g - The green component of the color.
      Returns:
      The index in the palette.
    • matchColor

      @Deprecated(forRemoval=true, since="1.20.2") 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(forRemoval=true, since="1.20.2") @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.
    • setMapColorCache

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