java.lang.Object
net.neoforged.fml.loading.moddiscovery.ModFile
All Implemented Interfaces:
IModFile

@Internal public class ModFile extends Object implements IModFile
  • Field Details

  • Constructor Details

  • Method Details

    • getSubstitutionMap

      public Supplier<Map<String,Object>> getSubstitutionMap()
      Description copied from interface: IModFile
      The mod files specific string data substitution map. The map returned here is used to interpolate values in the metadata of the included mods. Examples of where this is used in FML: While parsing the mods.toml file, keys like: ${file.xxxxx} are replaced with the values of this map, with keys xxxxx.
      Specified by:
      getSubstitutionMap in interface IModFile
      Returns:
      The string substitution map used during metadata load.
    • getLoaders

      public List<IModLanguageLoader> getLoaders()
    • getType

      public IModFile.Type getType()
      Description copied from interface: IModFile
      The type of the mod jar. This primarily defines how and where this mod file is loaded into the module system.
      Specified by:
      getType in interface IModFile
      Returns:
      The type of the mod file.
    • getFilePath

      public Path getFilePath()
      Description copied from interface: IModFile
      The path to the underlying mod file.
      Specified by:
      getFilePath in interface IModFile
      Returns:
      The path to the mod file.
    • getSecureJar

      public cpw.mods.jarhandling.SecureJar getSecureJar()
      Description copied from interface: IModFile
      The secure jar that represents this mod file.
      Specified by:
      getSecureJar in interface IModFile
      Returns:
      The secure jar.
    • getModInfos

      public List<IModInfo> getModInfos()
      Description copied from interface: IModFile
      Returns a list of all mods located inside this jar.

      If this method returns any entries then IModFile.getType() has to return IModFile.Type.MOD, else this mod file will not be loaded in the proper module layer in 1.17 and above.

      As such returning entries from this method is mutually exclusive with

      invalid reference
      #getLoaders()
      .
      Specified by:
      getModInfos in interface IModFile
      Returns:
      The mods in this mod file.
    • getAccessTransformers

      public List<Path> getAccessTransformers()
    • identifyMods

      public boolean identifyMods()
    • getMixinConfigs

      public List<ModFileParser.MixinConfig> getMixinConfigs()
    • scanFile

      public void scanFile(Consumer<Path> pathConsumer)
    • startScan

      public CompletionStage<ModFileScanData> startScan(Executor executor)
    • getScanResult

      public ModFileScanData getScanResult()
      Description copied from interface: IModFile
      The metadata scan result of all the classes located inside this file.
      Specified by:
      getScanResult in interface IModFile
      Returns:
      The metadata scan result.
    • setFileProperties

      public void setFileProperties(Map<String,Object> fileProperties)
    • findResource

      public Path findResource(String... path)
      Description copied from interface: IModFile
      Invoked to find a particular resource in this mod file, with the given path.
      Specified by:
      findResource in interface IModFile
      Parameters:
      path - The string representation of the path to find the mod resource on.
      Returns:
      The Path that represents the requested resource.
    • identifyLanguage

      public void identifyLanguage()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getFileName

      public String getFileName()
      Description copied from interface: IModFile
      The raw file name of this file.
      Specified by:
      getFileName in interface IModFile
      Returns:
      The raw file name.
    • getDiscoveryAttributes

      public ModFileDiscoveryAttributes getDiscoveryAttributes()
      Description copied from interface: IModFile
      Get attributes about how this mod file was discovered.
      Specified by:
      getDiscoveryAttributes in interface IModFile
    • setDiscoveryAttributes

      public void setDiscoveryAttributes(ModFileDiscoveryAttributes discoveryAttributes)
    • getModFileInfo

      public IModFileInfo getModFileInfo()
      Description copied from interface: IModFile
      The metadata info related to this particular file.
      Specified by:
      getModFileInfo in interface IModFile
      Returns:
      The info for this file.
    • getJarVersion

      public org.apache.maven.artifact.versioning.ArtifactVersion getJarVersion()
    • parseType

      private static IModFile.Type parseType(cpw.mods.jarhandling.SecureJar jar)