Class RegularColor
java.lang.Object
xyz.xenondevs.particle.data.ParticleData
xyz.xenondevs.particle.data.color.ParticleColor
xyz.xenondevs.particle.data.color.RegularColor
- Direct Known Subclasses:
DustData
An implementation of the
ParticleColor class that supports normal RGB values.
If you want to define a custom size for ParticleEffect.REDSTONE or the second
color for ParticleEffect.DUST_COLOR_TRANSITION, use DustData and
DustColorTransitionData. You can however use this class if you're just looking
to set the color.
- Since:
- 10.06.2019
- Author:
- ByteZ
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRegularColor(int red, int green, int blue) Initializes a newParticleDataobject.RegularColor(Color color) Initializes a newParticleDataobject. -
Method Summary
Modifier and TypeMethodDescriptionstatic RegularColorfromHSVHue(int hue) Constructs aRegularColorusing the HSV color spectrum.floatgetBlue()Gets the blue value of the color.floatgetGreen()Gets green red value of the color.floatgetRed()Gets the red value of the color.static RegularColorrandom()Generates a randomRegularColorinstance with a high saturation.static RegularColorrandom(boolean highSaturation) Generates a randomRegularColorinstance.Converts the currentParticleDatainstance into nms data.Methods inherited from class xyz.xenondevs.particle.data.ParticleData
getEffect, setEffect
-
Constructor Details
-
RegularColor
Initializes a newParticleDataobject.- Parameters:
color- theColorthe particle should have.
-
RegularColor
public RegularColor(int red, int green, int blue) Initializes a newParticleDataobject.- Parameters:
red- the red value of the color.green- the green value of the color.blue- the blue value of the color.
-
-
Method Details
-
getRed
public float getRed()Gets the red value of the color.- Overrides:
getRedin classParticleColor- Returns:
- the red value.
-
getGreen
public float getGreen()Gets green red value of the color.- Overrides:
getGreenin classParticleColor- Returns:
- the green value.
-
getBlue
public float getBlue()Gets the blue value of the color.- Overrides:
getBluein classParticleColor- Returns:
- the blue value.
-
toNMSData
Converts the currentParticleDatainstance into nms data. If the current minecraft version was released before 1.13 an int array should be returned. If the version was released after 1.12 a nms "ParticleParam" has to be returned.This method also supports TransitioningDust particles since 1.6.
- Specified by:
toNMSDatain classParticleColor- Returns:
- the nms data.
-
random
Generates a randomRegularColorinstance with a high saturation. If you want a completely randomColoruserandom(boolean)with false as the highSaturarion parameter.- Returns:
- a randomly generated
RegularColorinstance.
-
random
Generates a randomRegularColorinstance. If the highSaturation parameter is set to true, a random hue from the HSV spectrum will be used. Otherwise, 3 random integers ranging from 0 to 255 for the RGB values will be generated.- Parameters:
highSaturation- determines if the colors should have a high saturation.- Returns:
- a randomly generated
RegularColorinstance.
-
fromHSVHue
Constructs aRegularColorusing the HSV color spectrum.- Parameters:
hue- the hue the specific color has.- Returns:
- a
RegularColorinstance with the given HSV value as itsColor. - See Also:
-