Class Color
java.lang.Object
net.minestom.server.color.Color
- All Implemented Interfaces:
RGBLike
- Direct Known Subclasses:
AlphaColor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NetworkBuffer.Type<RGBLike> static final NetworkBuffer.Type<RGBLike> static final RGBLike -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintasRGB()Gets the color as an RGB integer.intblue()booleanstatic ColorfromRGBLike(RGBLike rgbLike) intgetBlue()Deprecated.intgetGreen()Deprecated.intgetRed()Deprecated.intgreen()inthashCode()Mixes this color with a series of other colors, as if they were combined in a crafting table.intred()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
-
green
-
blue
-
equals
-
hashCode
-
toString
-