Quilt Loader 1
Loading...
Searching...
No Matches
net.fabricmc.loader.impl.FabricLoaderImpl Class Reference
Inheritance diagram for net.fabricmc.loader.impl.FabricLoaderImpl:
net.fabricmc.loader.FabricLoader net.fabricmc.loader.api.FabricLoader

Classes

class  InitHelper
 Provides singleton for static init assignment regardless of load order.

Public Member Functions

ObjectShare getObjectShare ()
 Get the object share for inter-mod communication.
MappingResolver getMappingResolver ()
 Get the current mapping resolver.
Optional< ModContainergetModContainer (String id)
 Gets the container for a given mod.
Optional< ModContainerquilt_getModContainer (Class<?> clazz)
 Provided to make it easier to call QuiltLoader#getModContainer(Class) via reflection for fabric-only mods.
Collection< ModContainergetAllMods ()
 Gets all mod containers.
boolean isModLoaded (String id)
 Checks if a mod with a given ID is loaded.
boolean isDevelopmentEnvironment ()
 Checks if Fabric Loader is currently running in a "development" environment.
EnvType getEnvironmentType ()
 Get the current environment type.
Object getGameInstance ()
 Get the current game instance.
Path getGameDir ()
 Get the current game working directory.
File getGameDirectory ()
Path getConfigDir ()
 Get the current directory for game configuration files.
String getRawGameVersion ()
 Get the original unprocessed game version.
File getConfigDirectory ()
String[] getLaunchArguments (boolean sanitize)
 Gets the command line arguments used to launch the game.
Public Member Functions inherited from net.fabricmc.loader.FabricLoader
File getModsDirectory ()
Collection< ModContainergetModContainers ()
List< ModContainergetMods ()
void prepareModInit (File runDir, Object gameInstance)

Static Public Attributes

static final FabricLoaderImpl INSTANCE = new FabricLoaderImpl()
Static Public Attributes inherited from net.fabricmc.loader.FabricLoader
static final FabricLoader INSTANCE = FabricLoaderImpl.InitHelper.get()

Additional Inherited Members

Static Public Member Functions inherited from net.fabricmc.loader.api.FabricLoader
static FabricLoader getInstance ()
 Returns the public-facing Fabric Loader instance.

Member Function Documentation

◆ getAllMods()

Collection< ModContainer > net.fabricmc.loader.impl.FabricLoaderImpl.getAllMods ( )
inline

Gets all mod containers.

Returns
a collection of all loaded mod containers

Implements net.fabricmc.loader.api.FabricLoader.

◆ getConfigDir()

Path net.fabricmc.loader.impl.FabricLoaderImpl.getConfigDir ( )
inline

Get the current directory for game configuration files.

Returns
the configuration directory

Implements net.fabricmc.loader.api.FabricLoader.

◆ getConfigDirectory()

File net.fabricmc.loader.impl.FabricLoaderImpl.getConfigDirectory ( )
inline

◆ getEnvironmentType()

EnvType net.fabricmc.loader.impl.FabricLoaderImpl.getEnvironmentType ( )
inline

Get the current environment type.

Returns
the current environment type

Implements net.fabricmc.loader.api.FabricLoader.

◆ getGameDir()

Path net.fabricmc.loader.impl.FabricLoaderImpl.getGameDir ( )
inline

Get the current game working directory.

Returns
the working directory

Implements net.fabricmc.loader.api.FabricLoader.

◆ getGameDirectory()

File net.fabricmc.loader.impl.FabricLoaderImpl.getGameDirectory ( )
inline

◆ getGameInstance()

Object net.fabricmc.loader.impl.FabricLoaderImpl.getGameInstance ( )
inline

Get the current game instance.

Can represent a game client or server object. As such, the exact return is dependent on the current environment type.

The game instance may not always be available depending on the game version and environment.

Returns
A client or server instance object
Deprecated
This method is experimental and its use is discouraged.

Implements net.fabricmc.loader.api.FabricLoader.

◆ getLaunchArguments()

String[] net.fabricmc.loader.impl.FabricLoaderImpl.getLaunchArguments ( boolean sanitize)
inline

Gets the command line arguments used to launch the game.

The implementation will try to strip or obscure sensitive data like authentication tokens if sanitize is set to true. Callers are highly encouraged to enable sanitization as compromising the information can easily happen with logging, exceptions, serialization or other causes.

There is no guarantee that sanitize covers everything, so the launch arguments should still not be logged or otherwise exposed routinely even if the parameter is set to true. In particular it won't necessarily strip all information that can be used to identify the user.

Parameters
sanitizeWhether to try to remove or obscure sensitive information
Returns
the launch arguments for the game

Implements net.fabricmc.loader.api.FabricLoader.

◆ getMappingResolver()

MappingResolver net.fabricmc.loader.impl.FabricLoaderImpl.getMappingResolver ( )
inline

Get the current mapping resolver.

When performing reflection, a mod should always query the mapping resolver for the remapped names of members than relying on other heuristics.

Returns
the current mapping resolver instance
Since
0.4.1

Implements net.fabricmc.loader.api.FabricLoader.

◆ getModContainer()

Optional< ModContainer > net.fabricmc.loader.impl.FabricLoaderImpl.getModContainer ( String id)
inline

Gets the container for a given mod.

Parameters
idthe ID of the mod
Returns
the mod container, if present

Implements net.fabricmc.loader.api.FabricLoader.

◆ getObjectShare()

ObjectShare net.fabricmc.loader.impl.FabricLoaderImpl.getObjectShare ( )
inline

Get the object share for inter-mod communication.

The share allows mods to exchange data without directly referencing each other. This makes simple interaction easier by eliminating any compile- or run-time dependencies if the shared value type is independent of the mod (only Java/game/Fabric types like collections, primitives, String, Consumer, Function, ...).

Active interaction is possible as well since the shared values can be arbitrary Java objects. For example exposing a Runnable or Function allows the "API" user to directly invoke some program logic.

It is required to prefix the share key with the mod id like mymod:someProperty. Mods should not modify entries by other mods. The share is thread safe.

Returns
the global object share instance
Since
0.12.0

Implements net.fabricmc.loader.api.FabricLoader.

◆ getRawGameVersion()

String net.fabricmc.loader.impl.FabricLoaderImpl.getRawGameVersion ( )
inline

Get the original unprocessed game version.

There is normally a Semver-compatible derived game version, obtainable from a mod container representing the game, that is derived from this raw version. The raw version may not comparable or even follow a well defined pattern, making it unusable for dependency range evaluation.

Implements net.fabricmc.loader.api.FabricLoader.

◆ isDevelopmentEnvironment()

boolean net.fabricmc.loader.impl.FabricLoaderImpl.isDevelopmentEnvironment ( )
inline

Checks if Fabric Loader is currently running in a "development" environment.

Can be used for enabling debug mode or additional checks.

This should not be used to make assumptions on certain features, such as mappings, but as a toggle for certain functionalities.

Returns
whether or not Loader is currently in a "development" environment

Implements net.fabricmc.loader.api.FabricLoader.

◆ isModLoaded()

boolean net.fabricmc.loader.impl.FabricLoaderImpl.isModLoaded ( String id)
inline

Checks if a mod with a given ID is loaded.

Parameters
idthe ID of the mod, as defined in fabric.mod.json
Returns
whether or not the mod is present in this Fabric Loader instance

Implements net.fabricmc.loader.api.FabricLoader.

◆ quilt_getModContainer()

Optional< ModContainer > net.fabricmc.loader.impl.FabricLoaderImpl.quilt_getModContainer ( Class<?> clazz)
inline

Provided to make it easier to call QuiltLoader#getModContainer(Class) via reflection for fabric-only mods.

Implements net.fabricmc.loader.api.FabricLoader.


The documentation for this class was generated from the following file:
  • src/fabric/impl/java/net/fabricmc/loader/impl/FabricLoaderImpl.java