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

    • getId

      public String getId()
      Description copied from interface: IModFile
      A unique ID identifying this mod file.

      For mod files containing mods this will correspond with the mod id of the first mod contained in this file.

      For non-mod jar files, an approach to generating a unique id is using the same algorithm used by Java to determine a Java module name for a given Jar file, but this is not guaranteed.

      Specified by:
      getId in interface IModFile
    • getContents

      public JarContents getContents()
      Description copied from interface: IModFile
      Returns the contents of the mod file, which allow direct access to files in the mods jar file.
      Specified by:
      getContents in interface IModFile
      Returns:
      the contents of the mod file, which allow direct access to files in the mods jar file
    • 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.
    • 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.

      Specified by:
      getModInfos in interface IModFile
      Returns:
      The mods in this mod file.
    • getAccessTransformers

      public List<String> getAccessTransformers()
    • getMixinConfigs

      public List<ModFileParser.MixinConfig> getMixinConfigs()
    • 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)
    • 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(JarContents contents)
    • getModuleDescriptor

      public ModuleDescriptor getModuleDescriptor()
      Computing the module descriptor for the first time can be expensive, so this should be called once in parallel for all content.
    • close

      public void close()