Class ScannedMod
-
- All Implemented Interfaces:
public final class ScannedModWhat 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 aSetordistinct()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.
-
-
Field Summary
Fields Modifier and Type Field Description private final Filefileprivate final StringmodIDprivate final Sidenesssidenessprivate final List<ModDependency>dependenciesprivate final List<String>providesprivate final StringminecraftConstraintprivate final BooleandescriptorRead
-
Constructor Summary
Constructors Constructor Description ScannedMod(File file, String modID, Sideness sideness, List<ModDependency> dependencies, List<String> provides, String minecraftConstraint, Boolean descriptorRead)ScannedMod(File file, String modID, Sideness sideness, List<ModDependency> dependencies, List<String> provides, String minecraftConstraint)ScannedMod(File file, String modID, Sideness sideness, List<ModDependency> dependencies, List<String> provides)ScannedMod(File file, String modID, Sideness sideness, List<ModDependency> dependencies)ScannedMod(File file, String modID, Sideness sideness)ScannedMod(File file, String modID)ScannedMod(File file)
-
Method Summary
Modifier and Type Method Description final FilegetFile()The jar this was read from. final StringgetModID()The id the mod declares, or the filename when none could be read. final SidenessgetSideness()Which side this mod belongs on. final List<ModDependency>getDependencies()The non-platform mods this one declared it needs. final List<String>getProvides()Other mod-ids this mod answers to, from a Fabric/Quilt providesblock — empty for loaders that have no such concept.final StringgetMinecraftConstraint()The Minecraft version range the descriptor itself declares, verbatim, or nullwhen it declares none.final BooleangetDescriptorRead()Whether a descriptor was actually read, or this is the "nothing could be read" fallback. StringtoString()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. -
-
Constructor Detail
-
ScannedMod
ScannedMod(File file, String modID, Sideness sideness, List<ModDependency> dependencies, List<String> provides, String minecraftConstraint, Boolean descriptorRead)
-
ScannedMod
ScannedMod(File file, String modID, Sideness sideness, List<ModDependency> dependencies, List<String> provides, String minecraftConstraint)
-
ScannedMod
ScannedMod(File file, String modID, Sideness sideness, List<ModDependency> dependencies, List<String> provides)
-
ScannedMod
ScannedMod(File file, String modID, Sideness sideness, List<ModDependency> dependencies)
-
ScannedMod
ScannedMod(File file)
-
-
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
providesblock — 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 writingdepends: {"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
nullwhen 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:
modIDfalls back to the file name,sidenesstoSERVER, 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.
-
-
-
-