Class ModFile
java.lang.Object
net.neoforged.fml.loading.moddiscovery.ModFile
- All Implemented Interfaces:
IModFile
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.neoforged.neoforgespi.locating.IModFile
IModFile.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final JarContentsprivate static final Stringprivate ModFileDiscoveryAttributesprivate @Nullable CompletableFuture<ModFileScanData> private final Stringprivate final JarModuleInfoprivate final Stringprivate List<IModLanguageLoader> private static final org.slf4j.Loggerprivate final List<ModFileParser.MixinConfig> private final IModFileInfoprivate final IModFile.Typeprivate @Nullable ModuleDescriptorstatic final Attributes.Name -
Constructor Summary
ConstructorsConstructorDescriptionModFile(JarContents contents, @Nullable JarModuleInfo metadata, ModFileInfoParser parser, IModFile.Type type, ModFileDiscoveryAttributes discoveryAttributes) ModFile(JarContents contents, @Nullable JarModuleInfo metadata, ModFileInfoParser parser, ModFileDiscoveryAttributes attributes) ModFile(JarContents contents, ModFileInfoParser parser, ModFileDiscoveryAttributes attributes) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Returns the contents of the mod file, which allow direct access to files in the mods jar file.Get attributes about how this mod file was discovered.The raw file name of this file.The path to the underlying mod file.getId()A unique ID identifying this mod file.org.apache.maven.artifact.versioning.ArtifactVersionThe metadata info related to this particular file.Returns a list of all mods located inside this jar.Computing the module descriptor for the first time can be expensive, so this should be called once in parallel for all content.The metadata scan result of all the classes located inside this file.The mod files specific string data substitution map.getType()The type of the mod jar.voidprivate static IModFile.TypeparseType(JarContents contents) voidsetDiscoveryAttributes(ModFileDiscoveryAttributes discoveryAttributes) voidsetFileProperties(Map<String, Object> fileProperties) toString()
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
DEFAULT_ACCESS_TRANSFORMER
- See Also:
-
id
-
jarVersion
-
discoveryAttributes
-
fileProperties
-
loaders
-
contents
-
jarModuleInfo
-
moduleDescriptor
-
modFileType
-
modFileInfo
-
mixinConfigs
-
accessTransformers
-
futureScanResult
-
TYPE
-
-
Constructor Details
-
ModFile
public ModFile(JarContents contents, ModFileInfoParser parser, ModFileDiscoveryAttributes attributes) -
ModFile
public ModFile(JarContents contents, @Nullable @Nullable JarModuleInfo metadata, ModFileInfoParser parser, ModFileDiscoveryAttributes attributes) -
ModFile
public ModFile(JarContents contents, @Nullable @Nullable JarModuleInfo metadata, ModFileInfoParser parser, IModFile.Type type, ModFileDiscoveryAttributes discoveryAttributes)
-
-
Method Details
-
getId
Description copied from interface:IModFileA 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.
-
getContents
Description copied from interface:IModFileReturns the contents of the mod file, which allow direct access to files in the mods jar file.- Specified by:
getContentsin interfaceIModFile- Returns:
- the contents of the mod file, which allow direct access to files in the mods jar file
-
getSubstitutionMap
Description copied from interface:IModFileThe 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:
getSubstitutionMapin interfaceIModFile- Returns:
- The string substitution map used during metadata load.
-
getLoaders
-
getType
Description copied from interface:IModFileThe type of the mod jar. This primarily defines how and where this mod file is loaded into the module system. -
getFilePath
Description copied from interface:IModFileThe path to the underlying mod file.- Specified by:
getFilePathin interfaceIModFile- Returns:
- The path to the mod file.
-
getModInfos
Description copied from interface:IModFileReturns a list of all mods located inside this jar.If this method returns any entries then
IModFile.getType()has to returnIModFile.Type.MOD, else this mod file will not be loaded in the proper module layer in 1.17 and above.- Specified by:
getModInfosin interfaceIModFile- Returns:
- The mods in this mod file.
-
getAccessTransformers
-
getMixinConfigs
-
startScan
-
getScanResult
Description copied from interface:IModFileThe metadata scan result of all the classes located inside this file.- Specified by:
getScanResultin interfaceIModFile- Returns:
- The metadata scan result.
-
setFileProperties
-
identifyLanguage
public void identifyLanguage() -
toString
-
getFileName
Description copied from interface:IModFileThe raw file name of this file.- Specified by:
getFileNamein interfaceIModFile- Returns:
- The raw file name.
-
getDiscoveryAttributes
Description copied from interface:IModFileGet attributes about how this mod file was discovered.- Specified by:
getDiscoveryAttributesin interfaceIModFile
-
setDiscoveryAttributes
-
getModFileInfo
Description copied from interface:IModFileThe metadata info related to this particular file.- Specified by:
getModFileInfoin interfaceIModFile- Returns:
- The info for this file.
-
getJarVersion
public org.apache.maven.artifact.versioning.ArtifactVersion getJarVersion() -
parseType
-
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()
-