Class Utils.GeneralUtils

java.lang.Object
net.risingworld.api.utils.Utils.GeneralUtils
Enclosing class:
Utils

public abstract static class Utils.GeneralUtils extends Object
General game related functions.
  • Constructor Details

    • GeneralUtils

      public GeneralUtils()
  • Method Details

    • colorRGBAToInt

      public static int colorRGBAToInt(float r, float g, float b, float a)
      Converts a color (RGBA) to int.
      Parameters:
      r - the red value (0-1)
      g - the green value (0-1)
      b - the blue value (0-1)
      a - the alpha value (0-1)
      Returns:
      an int representing the RGBA color.
    • intToColorR

      public static float intToColorR(int color)
      Converts an int value into an RGBA color and returns the red color value.
      Parameters:
      color - the int color value.
      Returns:
      the red color value.
    • intToColorG

      public static float intToColorG(int color)
      Converts an int value into an RGBA color and returns the green color value.
      Parameters:
      color - the int color value.
      Returns:
      the green color value.
    • intToColorB

      public static float intToColorB(int color)
      Converts an int value into an RGBA color and returns the blue color value.
      Parameters:
      color - the int color value.
      Returns:
      the blue color value.
    • intToColorA

      public static float intToColorA(int color)
      Converts an int value into an RGBA color and returns the alpha value.
      Parameters:
      color - the int color value.
      Returns:
      the alpha value.
    • nextRandomColor

      public static int nextRandomColor(boolean alpha)
    • getFormattedTimeAndDate

      public static String getFormattedTimeAndDate(long timeInMillis)
    • getUnixTimestamp

      public static long getUnixTimestamp()
    • celsiusToFahrenheit

      public static float celsiusToFahrenheit(float celsius)
      Converts a celsius temperature to fahrenheit.
      Parameters:
      celsius - the temperature in celsius.
      Returns:
      the temperature in fahrenheit.
    • fahrenheitToCelsius

      public static float fahrenheitToCelsius(float fahrenheit)
      Converts a fahrenheit temperature to celsius.
      Parameters:
      fahrenheit - the temperature in fahrenheit.
      Returns:
      the temperature in celsius.