Skip to content
Alexander Gottwald edited this page Oct 9, 2017 · 3 revisions

Dependencies

With version 0.28 a dependency mechanism has been added to the modloader. Special entries in the modname.properties file control how the modloader loads and requires other mods.

Required mods

A mod 'X' can require other mods. Those mods must be present and they are loaded before mod 'X'. depend.requires=modname1, modname2

Conflicting mods

A mod 'X' can conflict with other mods. The modloader will refuse to load if conflicting mods are present. depend.conflicts=modname1, modname2

Controlling the loading order

The modloader can be instructed to load certain mods before or after mod 'A'. depend.suggests=modbefore1,modbefore2 depend.precedes=modafter1,modafter2 There is no hard requirement for the other mods to be present. An unknown mod in 'depend.suggests' or 'depend.precedes' is silently ignored.

On demand loading

A mod can be loaded on demand, i.e. it must be referenced by any mod which is not flagged as 'on demand' depend.ondemand=true

Importing a mods classes

A mod can import another mods classes if both use their own class loader (i.e. sharedClassLoader=false; this is the default) depend.import=modimport1,modimport2

The public classes and interfaces from the imported mod are then available for use in the importing mod.

Common usecases

Requirement for scriptrunner or serverpacks

A mod providing only a script or a serverpack should require 'scriptrunner' or 'serverpacks' as a dependency depend.requires=scriptrunner depend.requires=serverpacks

Library module dependencies

Assuming there is a 'httpserver' library mod which is used by the 'serverpacks' mod. The 'httpserver' mod should not be loaded if it is unused depend.ondemand=true The 'serverpacks' mod would import 'httpserver' depend.import=httpserver