Package net.minestom.server.color
Class AlphaColor
java.lang.Object
net.minestom.server.color.Color
net.minestom.server.color.AlphaColor
- All Implemented Interfaces:
RGBLike
A general purpose class for representing colors.
Colors must be in the range of 0-255.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final BinaryTagSerializer
<AlphaColor> static final NetworkBuffer.Type
<AlphaColor> static final AlphaColor
-
Constructor Summary
ConstructorDescriptionAlphaColor
(int argb) Creates an alpha color from an integer.AlphaColor
(int alpha, int red, int green, int blue) AlphaColor
(int alpha, @NotNull RGBLike rgbLike) Creates a color from an RGB-like color. -
Method Summary
Modifier and TypeMethodDescriptionint
alpha()
int
asARGB()
Gets the color as an RGB integer.boolean
int
hashCode()
toString()
@NotNull AlphaColor
withAlpha
(int alpha) @NotNull AlphaColor
withBlue
(int blue) @NotNull AlphaColor
withGreen
(int green) @NotNull AlphaColor
withRed
(int red) Methods inherited from class net.minestom.server.color.Color
asRGB, blue, fromRGBLike, getBlue, getGreen, getRed, green, mixWith, red
-
Field Details
-
NETWORK_TYPE
-
NBT_TYPE
-
WHITE
-
-
Constructor Details
-
AlphaColor
public AlphaColor(int alpha, int red, int green, int blue) -
AlphaColor
public AlphaColor(int argb) Creates an alpha color from an integer. This is done by reading each color component from the lowest order 32 bits of the integer, and creating a color from those components.- Parameters:
argb
- the integer
-
AlphaColor
Creates a color from an RGB-like color.- Parameters:
rgbLike
- the color
-
-
Method Details
-
withRed
-
withGreen
-
withBlue
-
withAlpha
-
asARGB
public int asARGB()Gets the color as an RGB integer.- Returns:
- An integer representation of this color, as 0xRRGGBB
-
alpha
public int alpha() -
equals
-
hashCode
public int hashCode() -
toString
-