Class FabricFamilyScanner

  • All Implemented Interfaces:
    de.griefed.serverpackcreator.api.modscanning.ModJarScanner

    
    public abstract class FabricFamilyScanner
    extends JsonDescriptorScanner
                        

    Base for the two scanners reading a Fabric-format descriptor: Fabric's own fabric.mod.json and the quilt.mod.json Quilt derived from it.

    Both state sideness the same way — a single environment string that either says client or does not — and both name the mod with an id. Only the paths to those fields differ (Quilt nests them under quilt_loader and minecraft), so they are constructor parameters here rather than a second copy of the logic. Dependencies are not shared: Fabric declares them as an object keyed by mod id, Quilt as an array of either objects or bare strings, so readDependencies stays abstract.

    • 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 Utilities getUtilities()
      String getScanAnnouncement()
      abstract List<ModDependency> readDependencies(JsonNode modConfig, String modId) The non-platform mods this descriptor names as dependencies.
      final ScannedMod read(File modJar) Read a single jar's descriptor into the verdict for that mod.
      • 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

      • FabricFamilyScanner

        FabricFamilyScanner(String descriptor, Array<String> idPath, Array<String> environmentPath, ObjectMapper objectMapper, Utilities utilities)
        Parameters:
        descriptor - Path of the descriptor inside the jar.
        idPath - Path to the mod's id within the descriptor.
        environmentPath - Path to the declared environment within the descriptor.
        objectMapper - For JSON-parsing.
        utilities - Common utilities used across ServerPackCreator.
    • Method Detail

      • readDependencies

         abstract List<ModDependency> readDependencies(JsonNode modConfig, String modId)

        The non-platform mods this descriptor names as dependencies.

        Abstract because the two formats disagree on the shape of the block, not merely its path. A descriptor declaring none must yield an empty list rather than throwing.

        Parameters:
        modConfig - The parsed descriptor.
        modId - Id of the mod being read, for logging.
      • read

         final ScannedMod read(File modJar)

        Read a single jar's descriptor into the verdict for that mod.

        Implementations are free to throw: scan catches everything and falls back to the defaults, so there is no need to guard the jar-level failure modes here. It is public because the distinction between what it throws is meaningful — MissingDescriptorException means the jar simply belongs to another loader, anything else means the jar could not be read — and that distinction is only observable here; scan deliberately flattens both to a default entry.