You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ModLoadingContext introduces a fair amount of global state through the field private static final ThreadLocal<ModLoadingContext> context, which is primarily used to resolve modids automatically in registration code. This usage should be removed, as global variables promote poor design and reduce readability of all code that reaches them.
There are two uses of this global state:
Automatic modid deduction (for registration of registry entries, configs, and client objects, and for IMC).
Provision of the language-specific loading context (i.e., FMLJavaModLoadingContext).
Case 1 is trivially resolvable. Modders should (and are very capable) of providing a modid to registration code at the time of registration. At most it adds one method argument, and produces a much higher degree of readability and transparency, and the registered object's modid is not at the whim of a global state object.
Case 2 is resolvable by passing the language-specific loading context as a constructor argument to the target mod.
The text was updated successfully, but these errors were encountered:
The
ModLoadingContext
introduces a fair amount of global state through the fieldprivate static final ThreadLocal<ModLoadingContext> context
, which is primarily used to resolve modids automatically in registration code. This usage should be removed, as global variables promote poor design and reduce readability of all code that reaches them.There are two uses of this global state:
FMLJavaModLoadingContext
).Case 1 is trivially resolvable. Modders should (and are very capable) of providing a modid to registration code at the time of registration. At most it adds one method argument, and produces a much higher degree of readability and transparency, and the registered object's modid is not at the whim of a global state object.
Case 2 is resolvable by passing the language-specific loading context as a constructor argument to the target mod.
The text was updated successfully, but these errors were encountered: