Package dev.boze.api.render
Class ColorMaker
java.lang.Object
dev.boze.api.render.ColorMaker
Helper class to initialize colors, and register colors in the user's colors
Use the name-less methods when you need a default color for an option.
Use the name-full methods when you want to register a color in the user's colors
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClientColorchangingColor(boolean hsb, boolean mirror, float speed, int... components) Creates a changing color marked as_default.static ClientColorchangingColor(boolean hsb, float speed, int... components) Convenience overload returning a default changing color.static ClientColorchangingColor(int... components) Convenience overload returning a default changing color.static ClientColorchangingColor(String name, boolean hsb, boolean mirror, float speed, int... components) Creates a changing color bound to a named entry.static ClientColorchangingColor(String name, boolean hsb, float speed, int... components) Convenience overload that defaults mirror to false.static ClientColorchangingColor(String name, int... components) Convenience overload that defaults hsb and mirror to false, and speed to 0.2F.static ClientColorRetrieves an existing color by name.static ClientColorgradientColor(String name, boolean hsb, boolean mirror, float angle, float scale, float motion, int... components) Creates a gradient color.static ClientColorgradientColor(String name, boolean hsb, float angle, float scale, float motion, int... components) Convenience overload that defaults mirror to false.static ClientColorgradientColor(String name, int... components) Convenience overload that defaults hsb and mirror to false; angle and motion to 0F; and scale to 1F.static intpack(int red, int green, int blue) Packs RGB components into an integer (0xRRGGBB).static ClientColorregister(String name, ClientColor color) Registers the provided color under the supplied name so it appears inside the user color list.static ClientColorstaticColor(int packed) Convenience overload that accepts a packed RGB value and marks the color as_default.static ClientColorstaticColor(int red, int green, int blue) Creates a static color marked as_default.static ClientColorstaticColor(String name, int packed) Packs the components before delegating tostaticColor(String, int, int, int).static ClientColorstaticColor(String name, int red, int green, int blue) Creates a static color.
-
Method Details
-
get
Retrieves an existing color by name.- Parameters:
name- Color identifier- Returns:
- Color or
nullif not present
-
staticColor
Creates a static color. Pass the registry name you intend to register withregister(String, ClientColor). For setting defaults, usestaticColor(int, int, int)which automatically uses_default. -
staticColor
Packs the components before delegating tostaticColor(String, int, int, int). -
staticColor
Creates a static color marked as_default. -
staticColor
Convenience overload that accepts a packed RGB value and marks the color as_default. -
changingColor
public static ClientColor changingColor(String name, boolean hsb, boolean mirror, float speed, int... components) Creates a changing color bound to a named entry. Pass the registry name you intend to register withregister(String, ClientColor). For setting defaults, usechangingColor(boolean, boolean, float, int...)which automatically uses_default. -
changingColor
Convenience overload that defaults mirror to false. -
changingColor
Convenience overload that defaults hsb and mirror to false, and speed to 0.2F. -
changingColor
public static ClientColor changingColor(boolean hsb, boolean mirror, float speed, int... components) Creates a changing color marked as_default. -
changingColor
Convenience overload returning a default changing color. -
changingColor
Convenience overload returning a default changing color. -
gradientColor
public static ClientColor gradientColor(String name, boolean hsb, boolean mirror, float angle, float scale, float motion, int... components) Creates a gradient color. Gradient defaults require a unique identifier. Use a name that starts with_default_followed by a suffix of your choosing (for example_default_exampleGradient). There is no name-less overload because gradients require unique names. -
gradientColor
public static ClientColor gradientColor(String name, boolean hsb, float angle, float scale, float motion, int... components) Convenience overload that defaults mirror to false. -
gradientColor
Convenience overload that defaults hsb and mirror to false; angle and motion to 0F; and scale to 1F. -
register
Registers the provided color under the supplied name so it appears inside the user color list. Existing colors using the same name are replaced. Use this after creating a color with a name when you want users to edit it inside the color manager. Option defaults created through the name-less helpers should not be registered. This shouldn't be spammed. -
pack
public static int pack(int red, int green, int blue) Packs RGB components into an integer (0xRRGGBB).
-