Class ScannedMod

  • All Implemented Interfaces:

    
    public final class ScannedMod
    
                        

    What one scanner made of one mod jar: which side it belongs on, and what it declared it needs.

    A scanner returns one of these per jar it was handed, whatever the outcome — a jar it could not open, or one carrying no descriptor it understands, comes back with the defaults rather than being dropped. The include-list is built solely from what the scanners return, so an omission here is a mod missing from the finished server pack.

    There is deliberately no equals/hashCode. Scanning a directory with two scanners yields two instances for one jar which may disagree on sideness, and value-equality would let a Set or distinct() keep whichever landed first and silently drop the other verdict. Merging those verdicts is a decision the caller makes explicitly; compare on file when identifying the same jar across two scans.

    • Method Detail

      • getFile

         final File getFile()

        The jar this was read from. The only identity that holds across two scans of the same directory.

      • getModID

         final String getModID()

        The id the mod declares, or the filename when none could be read.

        The fallback is not a real mod id, and anything joining on this field should expect that: an unreadable jar will not match a dependency naming the mod it actually contains. It is a filename rather than a shared placeholder so that two unreadable jars do not compare equal to each other.

      • getSideness

         final Sideness getSideness()

        Which side this mod belongs on. Defaults to Sideness.SERVER so a jar nothing could be determined about is kept: dropping a mod that does belong on the server breaks the pack, while keeping a superfluous one costs a few megabytes.

      • getDependencies

         final List<ModDependency> getDependencies()

        The non-platform mods this one declared it needs. The loader, Java and Minecraft are not recorded.

      • getProvides

         final List<String> getProvides()

        Other mod-ids this mod answers to, from a Fabric/Quilt provides block — empty for loaders that have no such concept.

        Carried because a dependency names an id, not a jar: Fabric API 0.92.11+1.20.1 declares "id": "fabric-api" and "provides": ["fabric"], so a mod writing depends: {"fabric": "*"} is satisfied by it. Without the alias, anything matching a dependency against a mod's own id alone — ModListCompiler's dependency rescue, above all — compares "fabric" to "fabric-api" and misses.

      • getMinecraftConstraint

         final String getMinecraftConstraint()

        The Minecraft version range the descriptor itself declares, verbatim, or null when it declares none.

        Every scanner parses this already and used to discard it — Fabric and Quilt as an excluded "platform" dependency, Forge and NeoForge by consuming the platform entry for its side. It is kept because it answers a question nothing else can: what did this jar say it was built for? A platform's declared version list is what its author ticked, and a boot chosen from that alone can land a jar on a Minecraft whose mappings it has never seen — which fails as a mixin error that looks exactly like a crash.

      • getDescriptorRead

         final Boolean getDescriptorRead()

        Whether a descriptor was actually read, or this is the "nothing could be read" fallback.

        The fallback is not an error — every scanner is handed the whole mods directory, so a Fabric-only jar yields one from the Quilt scanner by design. But it is indistinguishable from a real scan by value alone: modID falls back to the file name, sideness to SERVER, and the lists to empty, all of which a genuine descriptor could also produce. Anything merging two scans of the same jar therefore has to be told, or it will treat "I found nothing" as "I found nothing to declare" — which is exactly how a Quilt pack scan came to discard a Fabric jar's dependencies.

      • toString

         String toString()

        One line for a scan log, with the dependencies spelled out instead of left as object identities — they are the part a scan log is usually being read for, and the reason this is written by hand.