java.lang.Object
net.minestom.server.color.Color
- All Implemented Interfaces:
RGBLike
- Direct Known Subclasses:
AlphaColor
A general purpose class for representing colors.
Colors must be in the range of 0-255.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NetworkBuffer.Type
<RGBLike> static final NetworkBuffer.Type
<RGBLike> static final RGBLike
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
asRGB()
Gets the color as an RGB integer.int
blue()
boolean
static Color
fromRGBLike
(RGBLike rgbLike) int
getBlue()
Deprecated.int
getGreen()
Deprecated.int
getRed()
Deprecated.int
green()
int
hashCode()
Mixes this color with a series of other colors, as if they were combined in a crafting table.int
red()
toString()
withAlpha
(int alpha) withBlue
(int blue) withGreen
(int green) withRed
(int red)
-
Field Details
-
NETWORK_TYPE
-
RGB_BYTE_NETWORK_TYPE
-
CODEC
-
WHITE
-
-
Constructor Details
-
Color
public Color(int red, int green, int blue) -
Color
public Color(int rgb) Creates a color from an integer. This is done by reading each color component from the lowest order 24 bits of the integer, and creating a color from those components.- Parameters:
rgb
- the integer
-
Color
Creates a color from an RGB-like color.- Parameters:
rgbLike
- the color
-
-
Method Details
-
fromRGBLike
-
withRed
-
withGreen
-
withBlue
-
withAlpha
-
asRGB
public int asRGB()Gets the color as an RGB integer.- Returns:
- An integer representation of this color, as 0xRRGGBB
-
mixWith
Mixes this color with a series of other colors, as if they were combined in a crafting table. This function works out the average of each RGB component and then multiplies the components by a scale factor that is calculated from the average of all maximum values divided by the maximum of each average value. This is how Minecraft mixes colors.- Parameters:
colors
- the colors
-
getRed
Deprecated. -
getGreen
Deprecated. -
getBlue
Deprecated. -
red
public int red() -
green
public int green() -
blue
public int blue() -
equals
-
hashCode
public int hashCode() -
toString
-