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.

    Author:

    Griefed

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Regex getDependencyCheck() Matches a dependency entry worth recording, filtering out the malformed ones older packs contain.
      final Regex getDependencyReplace() Strips the version range off a dependency entry, leaving the mod id the scanner matches on.
      String getScanAnnouncement() Logged once before a scan starts, or null to announce nothing.
      ScannedMod read(File modJar) Read one mod's fml_cache_annotation.json for 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 a get() = ...toRegex(): this is read inside the per-dependency loops below, and a getter recompiled the pattern on every read. Regex is 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 additionalDependencyRegex held the identical literal and was what the two additionalDependency* checks actually used, so the pattern existed twice with only one copy documented — the same equal-valued-copy trap this module records for modFileEndings and zipCheck.

      • getScanAnnouncement

         String getScanAnnouncement()

        Logged once before a scan starts, or null to 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.json for its sideness.

        If clientSideOnly specifies "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.