Interface IModFile
- All Known Implementing Classes:
ModFile
@NonExtendable
public interface IModFile
Represents a single "mod" file in the runtime.
Although these are known as "Mod"-Files, they do not always represent mods. However, they should be more treated as an extension or modification of minecraft. And as such can contain any number of things, like language loaders, dependencies of other mods or code which does not interact with minecraft at all and is just a utility for any of the other mod files.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic IModFile
create
(cpw.mods.jarhandling.SecureJar jar, ModFileInfoParser parser) Builds a new mod file instance depending on the current runtime.static IModFile
create
(cpw.mods.jarhandling.SecureJar jar, ModFileInfoParser parser, IModFile.Type type, ModFileDiscoveryAttributes attributes) Builds a new mod file instance depending on the current runtime.static IModFile
create
(cpw.mods.jarhandling.SecureJar jar, ModFileInfoParser parser, ModFileDiscoveryAttributes attributes) Builds a new mod file instance depending on the current runtime.findResource
(String... pathName) Invoked to find a particular resource in this mod file, with the given path.Get attributes about how this mod file was discovered.The raw file name of this file.The path to the underlying mod file.The metadata info related to this particular file.Returns a list of all mods located inside this jar.The metadata scan result of all the classes located inside this file.cpw.mods.jarhandling.SecureJar
The secure jar that represents this mod file.The mod files specific string data substitution map.getType()
The type of the mod jar.
-
Method Details
-
create
static IModFile create(cpw.mods.jarhandling.SecureJar jar, ModFileInfoParser parser) throws InvalidModFileException Builds a new mod file instance depending on the current runtime.- Parameters:
jar
- The secure jar to load the mod file from.parser
- The parser which is responsible for parsing the metadata of the file itself.- Returns:
- The mod file.
- Throws:
InvalidModFileException
-
create
static IModFile create(cpw.mods.jarhandling.SecureJar jar, ModFileInfoParser parser, ModFileDiscoveryAttributes attributes) throws InvalidModFileException Builds a new mod file instance depending on the current runtime.- Parameters:
jar
- The secure jar to load the mod file from.parser
- The parser which is responsible for parsing the metadata of the file itself.attributes
- Additional attributes of the modfile.- Returns:
- The mod file.
- Throws:
InvalidModFileException
-
create
static IModFile create(cpw.mods.jarhandling.SecureJar jar, ModFileInfoParser parser, IModFile.Type type, ModFileDiscoveryAttributes attributes) throws InvalidModFileException Builds a new mod file instance depending on the current runtime.- Parameters:
jar
- The secure jar to load the mod file from.parser
- The parser which is responsible for parsing the metadata of the file itself.type
- the type of the modattributes
- Additional attributes of the modfile.- Returns:
- The mod file.
- Throws:
InvalidModFileException
-
findResource
Invoked to find a particular resource in this mod file, with the given path.- Parameters:
pathName
- The string representation of the path to find the mod resource on.- Returns:
- The
Path
that represents the requested resource.
-
getSubstitutionMap
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.- Returns:
- The string substitution map used during metadata load.
-
getType
IModFile.Type getType()The type of the mod jar. This primarily defines how and where this mod file is loaded into the module system.- Returns:
- The type of the mod file.
-
getFilePath
Path getFilePath()The path to the underlying mod file.- Returns:
- The path to the mod file.
-
getSecureJar
cpw.mods.jarhandling.SecureJar getSecureJar()The secure jar that represents this mod file.- Returns:
- The secure jar.
-
getModInfos
Returns a list of all mods located inside this jar.If this method returns any entries then
getType()
has to returnIModFile.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()
- Returns:
- The mods in this mod file.
-
getScanResult
ModFileScanData getScanResult()The metadata scan result of all the classes located inside this file.- Returns:
- The metadata scan result.
-
getFileName
String getFileName()The raw file name of this file.- Returns:
- The raw file name.
-
getDiscoveryAttributes
ModFileDiscoveryAttributes getDiscoveryAttributes()Get attributes about how this mod file was discovered. -
getModFileInfo
IModFileInfo getModFileInfo()The metadata info related to this particular file.- Returns:
- The info for this file.
-