Class ModDependency

  • All Implemented Interfaces:

    
    public final class ModDependency
    
                        

    A mod named as a dependency by another, and the side that dependency is needed on.

    Only the id is known — the declaring descriptor names a mod, not a file — so matching this back to a jar happens against ScannedMod.modID.

    • Method Detail

      • getModID

         final String getModID()

        Id of the mod being depended on, as the declaring descriptor spells it.

      • getSideness

         final Sideness getSideness()

        The side this dependency is needed on. Defaults to Sideness.SERVER: only Forge-style descriptors state a side per dependency, so for the others every recorded dependency is one the server may need.

      • getVersionConstraint

         final String getVersionConstraint()

        The version constraint the descriptor spelled, verbatim and unparsed, or null when it stated none. Left as written because the grammars differ per loader — Fabric and Quilt use npm-style ranges (>=0.92.0, ^2.0.0), Forge and NeoForge use Maven ranges ([15.2,)) — and a consumer that wants to match one is better served by the original text than by a lossy normalisation done here.

      • getOptional

         final Boolean getOptional()

        Whether the descriptor marked this dependency as one the mod can load without — Forge's mandatory = false, NeoForge's type = "optional" (and "incompatible"/"discouraged", neither of which is a thing to go and fetch).

        Defaults to false, i.e. required, which is both NeoForge's own documented default for an absent type and the safe direction: reading a required dependency as optional boots a mod without something it needs and fails as a crash, which can publish a wrong verdict, while reading an optional one as required merely refuses a boot and learns nothing.

      • getUnlessProvided

         final List<String> getUnlessProvided()

        Ids that satisfy this dependency instead of modID — Quilt's unless clause, empty for every other loader and for a Quilt entry that states none.

        Quilt Loader treats the requirement as met when any of these is present, and that is not a nicety: a mod written for either library declares "QSL, unless Fabric API is here", and reading only the primary id makes it look hard. Measured on the live grinder, 2026-09-10 — geophilic, terralith, trek and true-ending all ship {"id": "quilt_resource_loader", "unless": "fabric-resource-loader-v0"}, QSL publishes nothing past Minecraft 1.21, and all four were refused for a requirement their own descriptor said was optional in the presence of Fabric API.

        A list, because unless takes the same shapes depends does — a bare id, an object carrying one, or an array of either. Only the ids are kept: a consumer asking "is this satisfied?" needs to know what would satisfy it, and any range on the alternative is the loader's business, not ours.

      • toString

         String toString()

        One line for a scan log: the id that was depended on, the side asked for, and whether it is optional.