Class NilLoaderHelper

java.lang.Object
me.tamkungz.nilkit.helper.NilLoaderHelper

public final class NilLoaderHelper extends Object
NilLoaderHelper — convenience wrapper around NilLoader mod metadata APIs.

This helper centralizes common mod-list and metadata operations that are frequently used by SDK-based mods, so each mod does not need to re-implement boilerplate logic around NilModList / NilMetadata.

  • Method Details

    • isModLoaded

      public static boolean isModLoaded(String id)
      Returns true if a mod with the given id is loaded.
    • isAnyModLoaded

      public static boolean isAnyModLoaded(String... ids)
      Returns true if at least one provided mod id is loaded.
    • isAllModsLoaded

      public static boolean isAllModsLoaded(String... ids)
      Returns true if all provided mod ids are loaded.
    • getModMetadata

      public static Optional<nilloader.api.NilMetadata> getModMetadata(String id)
      Returns metadata for a mod id.
    • getModMetadataOrNull

      public static nilloader.api.NilMetadata getModMetadataOrNull(String id)
      Safe metadata lookup that returns null when unavailable.
    • getFirstLoadedMod

      public static Optional<nilloader.api.NilMetadata> getFirstLoadedMod(String... candidateIds)
      Returns the first loaded mod from the provided candidate ids.
    • getAllLoadedMods

      public static List<nilloader.api.NilMetadata> getAllLoadedMods()
      Returns all loaded mod metadata entries.
    • getLoadedModIds

      public static List<String> getLoadedModIds()
      Returns all loaded mod ids.
    • getLoadedModNames

      public static List<String> getLoadedModNames()
      Returns all loaded mod names.
    • getLoadedModsById

      public static Map<String,nilloader.api.NilMetadata> getLoadedModsById()
      Returns a map of loaded mods by id, preserving load iteration order.
    • getSourceFile

      public static File getSourceFile(String id)
      Returns the source file (JAR/path) of the given mod id.
    • getEntrypointNames

      public static Set<String> getEntrypointNames(String id)
      Returns declared entrypoint names for the given mod id.
    • getEntrypointClass

      public static String getEntrypointClass(String id, String phase)
      Returns a specific entrypoint target class for a given phase.
    • getEntrypoints

      public static Map<String,String> getEntrypoints(String id)
      Returns all entrypoint phase->class mappings for the given mod id.
    • hasEntrypoint

      public static boolean hasEntrypoint(String id, String phase)
      Returns true if a mod declares an entrypoint for a given phase.
    • describeMod

      public static String describeMod(String id)
      Returns a compact single-line description suitable for logs.
    • getSdkMetadata

      public static Optional<SdkModMetadata> getSdkMetadata(String id)
      Reads SDK-only metadata for a loaded mod by id from `.nilsdkmod.kdl` (fallback: legacy `.kdl` names).

      This is optional metadata and does not affect base NilLoader metadata parsing.

    • getSdkMetadata

      public static Optional<SdkModMetadata> getSdkMetadata(nilloader.api.NilMetadata mod)
      Reads SDK-only metadata from a NilMetadata.source location.
    • getMissingRequiredMods

      public static List<String> getMissingRequiredMods(String id)
      Returns list of missing required mod ids declared in SDK metadata.
    • hasMissingRequiredMods

      public static boolean hasMissingRequiredMods(String id)
      Returns true if this mod is currently missing any required dependencies.
    • areRequiredModsLoaded

      public static boolean areRequiredModsLoaded(String id)
      True when all required SDK metadata dependencies are currently loaded.
    • getLoadBefore

      public static List<String> getLoadBefore(String id)
      Returns ids this mod prefers to load before (advisory metadata).
    • getLoadAfter

      public static List<String> getLoadAfter(String id)
      Returns ids this mod prefers to load after (advisory metadata).
    • getIconPath

      public static String getIconPath(String id)
      Returns icon path from SDK metadata, or null if not declared.
    • getModUrl

      public static String getModUrl(String id)
      Returns mod page URL from SDK metadata, or null if not declared.
    • getSourceUrl

      public static String getSourceUrl(String id)
      Returns source repository URL from SDK metadata, or null if not declared.
    • getLicense

      public static String getLicense(String id)
      Returns license string from SDK metadata, or null if not declared.
    • getCredits

      public static List<String> getCredits(String id)
      Returns credits/contributors from SDK metadata.
    • getRequiredMods

      public static List<String> getRequiredMods(String id)
      Returns required mod ids declared in SDK metadata.
    • isSafeLoad

      public static boolean isSafeLoad(String id)
      Whether this mod should soft-fail on missing dependencies (default true).
    • getLoadedModIcons

      public static Map<String,String> getLoadedModIcons()
      Easy icon map for UI integrations (e.g., mod menu).
    • getModsWithEntrypoint

      public static List<String> getModsWithEntrypoint(String phase)
      Returns loaded mod ids that have declared an entrypoint for the given phase.
    • getMissingRequiredModsForLoadedMods

      public static Map<String,List<String>> getMissingRequiredModsForLoadedMods()
      Returns dependency report of loaded mods currently missing required dependencies.

      Map key is loaded mod id, map value is list of missing required ids.

    • getModsRequiring

      public static List<String> getModsRequiring(String requiredModId)
      Returns loaded mod ids that declare the given mod id as a required dependency.