Package mindustry.mod
Class Mods
java.lang.Object
mindustry.mod.Mods
- All Implemented Interfaces:
Loadable
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Represents a mod's state.static final class
static class
static class
Mod metadata information.static class
static enum
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a listener for parsed JSON objects.void
contextRun
(Mods.LoadedMod mod, Runnable run) void
Iterates through each mod with a main class.void
eachEnabled
(Cons<Mods.LoadedMod> cons) Iterates through each enabled mod.Tries to find the config file of a mod/plugin.Returns a file named 'config.json' in a special folder for the specified plugin.getIncompatibility
(Seq<String> out) void
handleContentError
(Content content, Throwable error) boolean
boolean
Imports an external mod file.list()
void
listFiles
(String directory, Cons2<Mods.LoadedMod, Fi> cons) Returns a list of files per mod subdirectory.void
load()
Loads all mods from the folder, but does not call any methods on them.void
Repacks all in-game sprites.void
Creates all the content found in mod files.void
This must be run on the main thread!void
loadSync()
void
removeMod
(Mods.LoadedMod mod) Removes a mod file and marks it for requiring a restart.boolean
resolveDependencies
(Seq<Mods.ModMeta> metas) Resolves the loading order of a list mods/plugins using their internal names.void
setEnabled
(Mods.LoadedMod mod, boolean enabled) Makes a mod enabled or disabled.boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface arc.assets.Loadable
getDependencies, getName
-
Constructor Details
-
Mods
public Mods()
-
-
Method Details
-
mainLoader
- Returns:
- the main class loader for all mods
-
getConfig
Returns a file named 'config.json' in a special folder for the specified plugin. Call this in init(). -
listFiles
Returns a list of files per mod subdirectory. -
getMod
- Returns:
- the loaded mod found by name, or null if not found.
-
getMod
- Returns:
- the loaded mod found by class, or null if not found.
-
importMod
Imports an external mod file. Folders are not supported here.- Throws:
IOException
-
loadAsync
public void loadAsync()Repacks all in-game sprites. -
loadSync
public void loadSync() -
removeMod
Removes a mod file and marks it for requiring a restart. -
getScripts
-
hasScripts
public boolean hasScripts()- Returns:
- whether the scripting engine has been initialized.
-
requiresReload
public boolean requiresReload() -
skipModLoading
public boolean skipModLoading()- Returns:
- whether to skip mod loading due to previous initialization failure.
-
load
public void load()Loads all mods from the folder, but does not call any methods on them. -
orderedMods
- Returns:
- mods ordered in the correct way needed for dependencies.
-
locateMod
-
hasContentErrors
public boolean hasContentErrors() -
loadScripts
public void loadScripts()This must be run on the main thread! -
loadContent
public void loadContent()Creates all the content found in mod files. -
handleContentError
-
addParseListener
Adds a listener for parsed JSON objects. -
getModStrings
- Returns:
- a list of mods and versions, in the format name:version.
-
setEnabled
Makes a mod enabled or disabled. shifts it. -
getIncompatibility
- Returns:
- the mods that the client is missing. The inputted array is changed to contain the extra mods that the client has but the server doesn't.
-
list
-
eachClass
Iterates through each mod with a main class. -
eachEnabled
Iterates through each enabled mod. -
contextRun
-
findMeta
Tries to find the config file of a mod/plugin. -
resolveDependencies
Resolves the loading order of a list mods/plugins using their internal names.
-