Class ColorMaker

java.lang.Object
dev.boze.api.render.ColorMaker

public final class ColorMaker extends Object
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 Details

    • get

      public static ClientColor get(String name)
      Retrieves an existing color by name.
      Parameters:
      name - Color identifier
      Returns:
      Color or null if not present
    • staticColor

      public static ClientColor staticColor(String name, int red, int green, int blue)
      Creates a static color.

      Pass the registry name you intend to register with register(String, ClientColor). For setting defaults, use staticColor(int, int, int) which automatically uses _default.
    • staticColor

      public static ClientColor staticColor(String name, int packed)
      Packs the components before delegating to staticColor(String, int, int, int).
    • staticColor

      public static ClientColor staticColor(int red, int green, int blue)
      Creates a static color marked as _default.
    • staticColor

      public static ClientColor staticColor(int packed)
      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 with register(String, ClientColor). For setting defaults, use changingColor(boolean, boolean, float, int...) which automatically uses _default.
    • changingColor

      public static ClientColor changingColor(String name, boolean hsb, float speed, int... components)
      Convenience overload that defaults mirror to false.
    • changingColor

      public static ClientColor changingColor(String name, int... components)
      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

      public static ClientColor changingColor(boolean hsb, float speed, int... components)
      Convenience overload returning a default changing color.
    • changingColor

      public static ClientColor changingColor(int... components)
      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

      public static ClientColor gradientColor(String name, int... components)
      Convenience overload that defaults hsb and mirror to false; angle and motion to 0F; and scale to 1F.
    • register

      public static ClientColor register(String name, ClientColor color)
      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).