Enum Class Mods

java.lang.Object
java.lang.Enum<Mods>
com.jozufozu.flywheel.util.Mods
All Implemented Interfaces:
Serializable, Comparable<Mods>, Constable

public enum Mods extends Enum<Mods>
For compatibility with and without another mod present, we have to define load conditions of the specific code
  • Enum Constant Details

    • STARLIGHT

      public static final Mods STARLIGHT
  • Method Details

    • values

      public static Mods[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Mods valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isLoaded

      public boolean isLoaded()
      Returns:
      a boolean of whether the mod is loaded or not based on mod id
    • runIfInstalled

      public <T> Optional<T> runIfInstalled(Supplier<Supplier<T>> toRun)
      Simple hook to run code if a mod is installed
      Parameters:
      toRun - will be run only if the mod is loaded
      Returns:
      Optional.empty() if the mod is not loaded, otherwise an Optional of the return value of the given supplier
    • executeIfInstalled

      public void executeIfInstalled(Supplier<Runnable> toExecute)
      Simple hook to execute code if a mod is installed
      Parameters:
      toExecute - will be executed only if the mod is loaded