Class WildfireHelper

java.lang.Object
com.wildfire.common.WildfireHelper

public final class WildfireHelper extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static <SERVICE> @Nullable SERVICE
    getOptionalService(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 correct
    static <SERVICE> SERVICE
    getService(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 correct
    static float
    round(float num, float decimalPlaces)
     
    static double
    snapToStep(double value, double stepSize)
     
    static String
    toFormattedPercent(double value)
     
    static com.mojang.serialization.Codec<org.joml.Vector3fc>
     
    static <T> com.mojang.serialization.MapCodec<T>
    withAlternative(com.mojang.serialization.MapCodec<T> primary, com.mojang.serialization.MapCodec<? extends T> alternative)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • round

      public static float round(float num, float decimalPlaces)
    • toFormattedPercent

      public static String toFormattedPercent(double value)
    • 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

      @Internal public static <SERVICE> SERVICE getService(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 correct
      Parameters:
      serviceClass - the interface class to search for
      Returns:
      the concrete implementation
      Throws:
      IllegalStateException - when an implementation is not found
    • getOptionalService

      @Internal public static <SERVICE> @Nullable SERVICE getOptionalService(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 correct
      Parameters:
      serviceClass - the interface class to search for
      Returns:
      the concrete implementation, or null if no implementation is found