Class MapPalette
java.lang.Object
net.elytrium.limboapi.api.protocol.packets.data.MapPalette
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final bytestatic final byteDeprecated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]convertImage(byte[] from, byte[] to, MapPalette.MapVersion version) Convert an image from MapVersion.MAXIMUM_VERSION to the desired versionstatic byte[]convertImage(int[] from, byte[] to, MapPalette.MapVersion version) Convert an image from MapVersion.MAXIMUM_VERSION to the desired versionstatic int[]convertImage(int[] from, int[] to, MapPalette.MapVersion version) Convert an image from MapVersion.MAXIMUM_VERSION to the desired versionstatic int[]convertImage(int[] image, MapPalette.MapVersion version) Convert an image from MapVersion.MAXIMUM_VERSION to the desired versionstatic byte[]imageToBytes(int[] from, byte[] to, com.velocitypowered.api.network.ProtocolVersion version) Convert an image to a byte[] using the palette.static int[]imageToBytes(int[] from, int[] to, com.velocitypowered.api.network.ProtocolVersion version) Convert an image to a byte[] using the palette.static int[]imageToBytes(int[] image, com.velocitypowered.api.network.ProtocolVersion version) Convert an image to a byte[] using the palette.static int[]imageToBytes(BufferedImage image) Convert an Image to a byte[] using the palette.static int[]imageToBytes(BufferedImage image, com.velocitypowered.api.network.ProtocolVersion version) Convert an Image to a byte[] using the palette.static bytetryFastMatchColor(int rgb, com.velocitypowered.api.network.ProtocolVersion version) Get the index of the closest matching color in the palette to the given color.
-
Field Details
-
WHITE
Deprecated.UseColor.WHITEinstead.- See Also:
-
TRANSPARENT
public static final byte TRANSPARENT- See Also:
-
-
Constructor Details
-
MapPalette
public MapPalette()
-
-
Method Details
-
imageToBytes
Convert an Image to a byte[] using the palette. Uses reduced set of colors, to support more colors useimageToBytes(BufferedImage, ProtocolVersion)- Parameters:
image- The image to convert.- Returns:
- A byte[] containing the pixels of the image.
-
imageToBytes
public static int[] imageToBytes(BufferedImage image, com.velocitypowered.api.network.ProtocolVersion version) Convert an Image to a byte[] using the palette.- Parameters:
image- The image to convert.version- The ProtocolVersion to support more colors.- Returns:
- A byte[] containing the pixels of the image.
-
imageToBytes
public static int[] imageToBytes(int[] image, com.velocitypowered.api.network.ProtocolVersion version) Convert an image to a byte[] using the palette.- Parameters:
image- The image to convert.version- The ProtocolVersion to support more colors.- Returns:
- A byte[] containing the pixels of the image.
-
imageToBytes
public static int[] imageToBytes(int[] from, int[] to, com.velocitypowered.api.network.ProtocolVersion version) Convert an image to a byte[] using the palette.- Parameters:
from- The image to convert.to- Output image.version- The ProtocolVersion to support more colors.- Returns:
- A byte[] containing the pixels of the image.
-
imageToBytes
public static byte[] imageToBytes(int[] from, byte[] to, com.velocitypowered.api.network.ProtocolVersion version) Convert an image to a byte[] using the palette.- Parameters:
from- The image to convert.to- Output image.version- The ProtocolVersion to support more colors.- Returns:
- A byte[] containing the pixels of the image.
-
tryFastMatchColor
public static byte tryFastMatchColor(int rgb, com.velocitypowered.api.network.ProtocolVersion version) Get the index of the closest matching color in the palette to the given color. Uses caching and downscaling of color values.- Parameters:
rgb- The Color to match.- Returns:
- The index in the palette.
-
convertImage
Convert an image from MapVersion.MAXIMUM_VERSION to the desired version- Parameters:
image- The image to convert.version- The ProtocolVersion to support more colors.- Returns:
- A byte[] containing the pixels of the image.
-
convertImage
Convert an image from MapVersion.MAXIMUM_VERSION to the desired version- Parameters:
from- The image to convert.to- Output image.version- The ProtocolVersion to support more colors.- Returns:
- A byte[] containing the pixels of the image.
-
convertImage
Convert an image from MapVersion.MAXIMUM_VERSION to the desired version- Parameters:
from- The image to convert.to- Output image.version- The ProtocolVersion to support more colors.- Returns:
- A byte[] containing the pixels of the image.
-
convertImage
Convert an image from MapVersion.MAXIMUM_VERSION to the desired version- Parameters:
from- The image to convert.to- Output image.version- The ProtocolVersion to support more colors.- Returns:
- A byte[] containing the pixels of the image.
-
Color.WHITEinstead.