Package net.risingworld.api.utils
Klasse Utils.GeneralUtils
java.lang.Object
net.risingworld.api.utils.Utils.GeneralUtils
- Umschließende Klasse:
Utils
General game related functions.
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic float
celsiusToFahrenheit
(float celsius) Converts a celsius temperature to fahrenheit.static int
colorRGBAToInt
(float r, float g, float b, float a) Converts a color (RGBA) to int.static float
fahrenheitToCelsius
(float fahrenheit) Converts a fahrenheit temperature to celsius.static String
getFormattedTimeAndDate
(long timeInMillis) static long
static float
intToColorA
(int color) Converts an int value into an RGBA color and returns the alpha value.static float
intToColorB
(int color) Converts an int value into an RGBA color and returns the blue color value.static float
intToColorG
(int color) Converts an int value into an RGBA color and returns the green color value.static float
intToColorR
(int color) Converts an int value into an RGBA color and returns the red color value.static int
nextRandomColor
(boolean alpha)
-
Konstruktordetails
-
GeneralUtils
public GeneralUtils()
-
-
Methodendetails
-
colorRGBAToInt
public static int colorRGBAToInt(float r, float g, float b, float a) Converts a color (RGBA) to int.- Parameter:
r
- the red value (0-1)g
- the green value (0-1)b
- the blue value (0-1)a
- the alpha value (0-1)- Gibt zurück:
- an int representing the RGBA color.
- Example: Convert an RGBA color to an int and vice versa
-
intToColorR
public static float intToColorR(int color) Converts an int value into an RGBA color and returns the red color value.- Parameter:
color
- the int color value.- Gibt zurück:
- 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.- Parameter:
color
- the int color value.- Gibt zurück:
- 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.- Parameter:
color
- the int color value.- Gibt zurück:
- the blue color value.
-
intToColorA
public static float intToColorA(int color) Converts an int value into an RGBA color and returns the alpha value.- Parameter:
color
- the int color value.- Gibt zurück:
- the alpha value.
-
nextRandomColor
public static int nextRandomColor(boolean alpha) -
getFormattedTimeAndDate
-
getUnixTimestamp
public static long getUnixTimestamp() -
celsiusToFahrenheit
public static float celsiusToFahrenheit(float celsius) Converts a celsius temperature to fahrenheit.- Parameter:
celsius
- the temperature in celsius.- Gibt zurück:
- the temperature in fahrenheit.
-
fahrenheitToCelsius
public static float fahrenheitToCelsius(float fahrenheit) Converts a fahrenheit temperature to celsius.- Parameter:
fahrenheit
- the temperature in fahrenheit.- Gibt zurück:
- the temperature in celsius.
-