Package mindustry.mod

Class Mods.LoadedMod

java.lang.Object
mindustry.mod.Mods.LoadedMod
All Implemented Interfaces:
Disposable, Publishable
Enclosing class:
Mods

public static class Mods.LoadedMod extends Object implements Publishable, Disposable
Represents a mod's state. May be a jar file, folder or zip.
  • Field Details

    • file

      public final Fi file
      The location of this mod's zip file/folder on the disk.
    • root

      public final Fi root
      The root zip file; points to the contents of this mod. In the case of folders, this is the same as the mod's file.
    • main

      @Nullable public final Mod main
      The mod's main class; may be null.
    • name

      public final String name
      Internal mod name. Used for textures.
    • meta

      public final Mods.ModMeta meta
      This mod's metadata.
    • dependencies

      public Seq<Mods.LoadedMod> dependencies
      This mod's dependencies as already-loaded mods.
    • missingDependencies

      public Seq<String> missingDependencies
      All missing dependencies of this mod as strings.
    • erroredContent

      public ObjectSet<Content> erroredContent
      Content with initialization code.
    • state

      public Mods.ModState state
      Current state of this mod.
    • iconTexture

      @Nullable public Texture iconTexture
      Icon texture. Should be disposed.
    • loader

      @Nullable public ClassLoader loader
      Class loader for JAR mods. Null if the mod isn't loaded or this isn't a jar mod.
  • Constructor Details

  • Method Details

    • isJava

      public boolean isJava()
      Returns:
      whether this is a java class mod.
    • getRepo

      @Nullable public String getRepo()
    • setRepo

      public void setRepo(String repo)
    • enabled

      public boolean enabled()
    • shouldBeEnabled

      public boolean shouldBeEnabled()
    • hasUnmetDependencies

      public boolean hasUnmetDependencies()
    • hasContentErrors

      public boolean hasContentErrors()
    • isSupported

      public boolean isSupported()
      Returns:
      whether this mod is supported by the game version
    • isBlacklisted

      public boolean isBlacklisted()
      Some mods are known to cause issues with the game; this detects and returns whether a mod is manually blacklisted.
    • isOutdated

      public boolean isOutdated()
      Returns:
      whether this mod is outdated, e.g. not compatible with v7.
    • getMinMajor

      public int getMinMajor()
    • dispose

      public void dispose()
      Description copied from interface: Disposable
      Releases all resources of this object.
      Specified by:
      dispose in interface Disposable
    • getSteamID

      public String getSteamID()
      Specified by:
      getSteamID in interface Publishable
      Returns:
      workshop item ID, or null if this isn't on the workshop.
    • addSteamID

      public void addSteamID(String id)
      Description copied from interface: Publishable
      adds a steam ID to this item once it's published. should save the item to make sure this change is persisted.
      Specified by:
      addSteamID in interface Publishable
    • removeSteamID

      public void removeSteamID()
      Description copied from interface: Publishable
      removes the item ID; called when the item isn't found.
      Specified by:
      removeSteamID in interface Publishable
    • steamTitle

      public String steamTitle()
      Specified by:
      steamTitle in interface Publishable
      Returns:
      default title of the listing.
    • steamDescription

      public String steamDescription()
      Specified by:
      steamDescription in interface Publishable
      Returns:
      standard steam listing description, may be null. this is editable by users after release.
    • steamTag

      public String steamTag()
      Specified by:
      steamTag in interface Publishable
      Returns:
      the tag that this content has. e.g. 'schematic' or 'map'.
    • createSteamFolder

      public Fi createSteamFolder(String id)
      Specified by:
      createSteamFolder in interface Publishable
      Returns:
      a folder with everything needed for this piece of content in it; does not need to be a copy.
    • createSteamPreview

      public Fi createSteamPreview(String id)
      Specified by:
      createSteamPreview in interface Publishable
      Returns:
      a preview file PNG.
    • prePublish

      public boolean prePublish()
      Description copied from interface: Publishable
      called before this item is published.
      Specified by:
      prePublish in interface Publishable
      Returns:
      true to signify that everything is cool and good, or false to significy that the user has done something wrong. if false is returned, make sure to show a dialog explaining the error.
    • toString

      public String toString()
      Overrides:
      toString in class Object