Class ForgeAnnotationScanner
-
- All Implemented Interfaces:
-
de.griefed.serverpackcreator.api.modscanning.ModJarScanner
public final class ForgeAnnotationScanner extends JsonDescriptorScanner
fml-cache-annotation.json-based scanning of Forge-Minecraft mods of older versions.Griefed
-
-
Field Summary
Fields Modifier and Type Field Description private final RegexdependencyCheckprivate final RegexdependencyReplaceprivate final StringscanAnnouncement
-
Constructor Summary
Constructors Constructor Description ForgeAnnotationScanner(ObjectMapper objectMapper, Utilities utilities)
-
Method Summary
Modifier and Type Method Description final RegexgetDependencyCheck()Matches a dependency entry worth recording, filtering out the malformed ones older packs contain. final RegexgetDependencyReplace()Strips the version range off a dependency entry, leaving the mod id the scanner matches on. StringgetScanAnnouncement()Logged once before a scan starts, or nullto announce nothing.ScannedModread(File modJar)Read one mod's fml_cache_annotation.jsonfor its sideness.-
Methods inherited from class de.griefed.serverpackcreator.api.modscanning.JsonDescriptorScanner
getJarJson -
Methods inherited from class de.griefed.serverpackcreator.api.modscanning.DescriptorScanner
scan -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
ForgeAnnotationScanner
ForgeAnnotationScanner(ObjectMapper objectMapper, Utilities utilities)
- Parameters:
objectMapper- For JSON-parsing.utilities- Common utilities used across ServerPackCreator.
-
-
Method Detail
-
getDependencyCheck
final Regex getDependencyCheck()
Matches a dependency entry worth recording, filtering out the malformed ones older packs contain.
A
val, not aget() = ...toRegex(): this is read inside the per-dependency loops below, and a getter recompiled the pattern on every read.Regexis safe to share — matching creates its own matcher — so one instance per scanner is all that is needed.
-
getDependencyReplace
final Regex getDependencyReplace()
Strips the version range off a dependency entry, leaving the mod id the scanner matches on.
The single source of truth for that pattern: a private
additionalDependencyRegexheld the identical literal and was what the twoadditionalDependency*checks actually used, so the pattern existed twice with only one copy documented — the same equal-valued-copy trap this module records formodFileEndingsandzipCheck.
-
getScanAnnouncement
String getScanAnnouncement()
Logged once before a scan starts, or
nullto announce nothing. Exists only because the per-loader wording is user-facing progress output.
-
read
ScannedMod read(File modJar)
Read one mod's
fml_cache_annotation.jsonfor its sideness.If
clientSideOnlyspecifies"value": "true", and the mod is not listed as a dependency of another mod, it is later excluded from the server pack.- Parameters:
modJar- The jar whose annotation cache to read.- Returns:
What this mod declared.
-
-
-
-