Class WildfireHelper
java.lang.Object
com.wildfire.common.WildfireHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic <SERVICE> @Nullable SERVICEgetOptionalService(Class<SERVICE> serviceClass) Loads a WildfireGender service from ServiceLoader, ensuring that the correct classloader is used instead of relying on the context classloader, which may not be correctstatic <SERVICE> SERVICEgetService(Class<SERVICE> serviceClass) Loads a WildfireGender service from ServiceLoader, ensuring that the correct classloader is used instead of relying on the context classloader, which may not be correctstatic floatround(float num, float decimalPlaces) static doublesnapToStep(double value, double stepSize) static StringtoFormattedPercent(double value) static com.mojang.serialization.Codec<org.joml.Vector3fc> validatedVector(ConfigRange<Float> xRange, ConfigRange<Float> yRange, ConfigRange<Float> zRange) static <T> com.mojang.serialization.MapCodec<T> withAlternative(com.mojang.serialization.MapCodec<T> primary, com.mojang.serialization.MapCodec<? extends T> alternative)
-
Method Details
-
round
public static float round(float num, float decimalPlaces) -
toFormattedPercent
-
snapToStep
public static double snapToStep(double value, double stepSize) -
withAlternative
public static <T> com.mojang.serialization.MapCodec<T> withAlternative(com.mojang.serialization.MapCodec<T> primary, com.mojang.serialization.MapCodec<? extends T> alternative) -
validatedVector
public static com.mojang.serialization.Codec<org.joml.Vector3fc> validatedVector(ConfigRange<Float> xRange, ConfigRange<Float> yRange, ConfigRange<Float> zRange) -
getService
Loads a WildfireGender service from ServiceLoader, ensuring that the correct classloader is used instead of relying on the context classloader, which may not be correct- Parameters:
serviceClass- the interface class to search for- Returns:
- the concrete implementation
- Throws:
IllegalStateException- when an implementation is not found
-
getOptionalService
Loads a WildfireGender service from ServiceLoader, ensuring that the correct classloader is used instead of relying on the context classloader, which may not be correct- Parameters:
serviceClass- the interface class to search for- Returns:
- the concrete implementation, or
nullif no implementation is found
-