Quilt Loader 1
Loading...
Searching...
No Matches
org.quiltmc.loader.api.ModContainer Interface Reference
Inheritance diagram for org.quiltmc.loader.api.ModContainer:
org.quiltmc.loader.api.plugin.ModContainerExt org.quiltmc.loader.impl.metadata.qmj.ProvidedModContainer org.quiltmc.loader.impl.plugin.base.InternalModContainerBase org.quiltmc.loader.impl.plugin.fabric.FabricModContainer org.quiltmc.loader.impl.plugin.quilt.BuiltinModContainer org.quiltmc.loader.impl.plugin.quilt.QuiltModContainer

Classes

enum  BasicSourceType

Public Member Functions

ModMetadata metadata ()
Path rootPath ()
 Returns the root directory of the mod (inside JAR/folder), exposing its contents.
default Path getPath (String file)
 Gets an NIO reference to a file inside the JAR.
List< List< Path > > getSourcePaths ()
 Gets where the mod was loaded from.
BasicSourceType getSourceType ()
 Gets the "basic source type" of this mod, which represents where it comes from.
ClassLoader getClassLoader ()
 Retrieves the ClassLoader which directly stores classes for this mod.

Member Function Documentation

◆ getClassLoader()

ClassLoader org.quiltmc.loader.api.ModContainer.getClassLoader ( )

Retrieves the ClassLoader which directly stores classes for this mod.

Most mods will have no use for this method, since classes from any mod can be loaded by using the ClassLoader that loaded that mods class (so using Class.forName("pkg.ClassName") will work for any mod).

This returns null for BasicSourceType#BUILTIN mods, and potentially BasicSourceType#OTHER.

Returns
The ClassLoader which loads classes for this mod, or null if quilt-loader doesn't provide that ClassLoader.

Implemented in org.quiltmc.loader.api.plugin.ModContainerExt.

◆ getPath()

default Path org.quiltmc.loader.api.ModContainer.getPath ( String file)
inline

Gets an NIO reference to a file inside the JAR.

The path is not guaranteed to exist!

A path returned by this method may be incompatible with Path#toFile as its FileSystem doesn't necessarily represent the OS file system, but potentially a virtual view of jar contents or another abstraction.
Files contains methods that operate on Paths, instead of File.

Parameters
fileThe location from root, using / as a separator.
Returns
the path to a given file

◆ getSourcePaths()

List< List< Path > > org.quiltmc.loader.api.ModContainer.getSourcePaths ( )

Gets where the mod was loaded from.

Each sub-list is a full path from the root of the filesystem, up through any jar-in-jars that the mod may be contained by.

This location is not necessarily identical to the code source used at runtime, a mod may get copied or otherwise transformed before being put on the class path. It thus mostly represents the installation and initial loading, not what is being directly accessed at runtime.

The mod origin is provided for working with the installation like telling the user where a mod has been installed at. Accessing the files inside a mod jar/folder should use getPath and rootPath instead. Those also abstract jar accesses through the virtual ZipFileSystem away.

Returns
A list of every source path this mod is loaded from. May be empty if we can't turn the sources into a path.

Implemented in org.quiltmc.loader.impl.metadata.qmj.ProvidedModContainer, and org.quiltmc.loader.impl.plugin.base.InternalModContainerBase.

◆ getSourceType()

BasicSourceType org.quiltmc.loader.api.ModContainer.getSourceType ( )

Gets the "basic source type" of this mod, which represents where it comes from.

Some plugins may provide more information on where their mods came from - although you'll need to reference those plugins for obtaining that information. (It might be exposed in a getter method in one of the plugins classes, or it could be an extension interface of this class).

Implemented in org.quiltmc.loader.impl.metadata.qmj.ProvidedModContainer, org.quiltmc.loader.impl.plugin.fabric.FabricModContainer, org.quiltmc.loader.impl.plugin.quilt.BuiltinModContainer, and org.quiltmc.loader.impl.plugin.quilt.QuiltModContainer.

◆ rootPath()

Path org.quiltmc.loader.api.ModContainer.rootPath ( )

Returns the root directory of the mod (inside JAR/folder), exposing its contents.

A path returned by this method may be incompatible with Path#toFile as its FileSystem doesn't necessarily represent the OS file system, but potentially a virtual view of jar contents or another abstraction.
Files contains methods that operate on Paths, instead of File.

Returns
the root directory of the mod.

Implemented in org.quiltmc.loader.impl.metadata.qmj.ProvidedModContainer, and org.quiltmc.loader.impl.plugin.base.InternalModContainerBase.


The documentation for this interface was generated from the following file:
  • src/main/java/org/quiltmc/loader/api/ModContainer.java