public interface FabricLoader
To obtain a working instance, call getInstance().
| Modifier and Type | Method and Description |
|---|---|
Collection<ModContainer> |
getAllMods()
Gets all mod containers.
|
Path |
getConfigDir()
Get the current directory for game configuration files.
|
File |
getConfigDirectory()
Deprecated.
|
<T> List<EntrypointContainer<T>> |
getEntrypointContainers(String key,
Class<T> type)
Returns all entrypoints declared under a
key, assuming they are of a specific type. |
<T> List<T> |
getEntrypoints(String key,
Class<T> type)
Returns all entrypoints declared under a
key, assuming they are of a specific type. |
EnvType |
getEnvironmentType()
Get the current environment type.
|
Path |
getGameDir()
Get the current game working directory.
|
File |
getGameDirectory()
Deprecated.
|
Object |
getGameInstance()
Deprecated.
This method is experimental and it's use is discouraged.
|
static FabricLoader |
getInstance()
Returns the public-facing Fabric Loader instance.
|
String[] |
getLaunchArguments(boolean sanitize)
Gets the command line arguments used to launch the game.
|
MappingResolver |
getMappingResolver()
Get the current mapping resolver.
|
Optional<ModContainer> |
getModContainer(String id)
Gets the container for a given mod.
|
boolean |
isDevelopmentEnvironment()
Checks if Fabric Loader is currently running in a "development"
environment.
|
boolean |
isModLoaded(String id)
Checks if a mod with a given ID is loaded.
|
static FabricLoader getInstance()
<T> List<T> getEntrypoints(String key, Class<T> type)
key, assuming they are of a specific type.T - the type of entrypointskey - the key in entrypoint declaration in fabric.mod.jsontype - the type of entrypointsgetEntrypointContainers(String, Class)<T> List<EntrypointContainer<T>> getEntrypointContainers(String key, Class<T> type)
key, assuming they are of a specific type.
The entrypoint is declared in the fabric.mod.json as following:
Multiple keys can be present in the"entrypoints": { "<a key>": [ <a list of entrypoint declarations> ] }
entrypoints section.
An entrypoint declaration indicates that an arbitrary notation is sent
to a LanguageAdapter to offer an instance of entrypoint. It is
either a string, or an object. An object declaration
is of this form:
A string declaration{ "adapter": "<a custom adatper>" "value": "<an arbitrary notation>" }
<an arbitrary notation> is equivalent to
where the{ "adapter": "default" "value": "<an arbitrary notation>" }
default adapter is the adapter
offered by Fabric Loader. T - the type of entrypointskey - the key in entrypoint declaration in fabric.mod.jsontype - the type of entrypointsEntrypointException - if a problem arises during entrypoint creationLanguageAdapterMappingResolver getMappingResolver()
When performing reflection, a mod should always query the mapping resolver for the remapped names of members than relying on other heuristics.
Optional<ModContainer> getModContainer(String id)
id - the ID of the modCollection<ModContainer> getAllMods()
boolean isModLoaded(String id)
id - the ID of the mod, as defined in fabric.mod.jsonboolean isDevelopmentEnvironment()
This should not be used to make assumptions on certain features, such as mappings, but as a toggle for certain functionalities.
EnvType getEnvironmentType()
@Deprecated Object getGameInstance()
The game instance may not always be available depending on the game version and environment.
Path getGameDir()
@Deprecated File getGameDirectory()
Path getConfigDir()
@Deprecated File getConfigDirectory()
String[] getLaunchArguments(boolean sanitize)
sanitize is true.sanitize - Whether to remove sensitive information