Class DefaultModDisplayInfo

java.lang.Object
net.neoforged.neoforge.client.gui.modlist.DefaultModDisplayInfo
All Implemented Interfaces:
IExtensionPoint, ModDisplayInfo

public class DefaultModDisplayInfo extends Object implements ModDisplayInfo
The default implementation of ModDisplayInfo.
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • container

      private final ModContainer container
  • Constructor Details

    • DefaultModDisplayInfo

      public DefaultModDisplayInfo(ModContainer container)
  • Method Details

    • id

      public String id()
      Returns the mod ID. This is used to retrieve the mod container, configuration screen extension point, and other relevant information.
      Specified by:
      id in interface ModDisplayInfo
      Returns:
      the mod ID
    • displayName

      public Component displayName()
      Returns the display name. This is always displayed, even if empty. Click actions do not work on this component.
      Specified by:
      displayName in interface ModDisplayInfo
      Returns:
      the display name
    • version

      public String version()
      Returns the mod version. This is always displayed, even if empty.
      Specified by:
      version in interface ModDisplayInfo
      Returns:
      the mod version
    • authors

      public Component authors()
      Returns the mod authors. This is displayed if it is not an empty component. This pulls from the authors key of the mod info.
      Specified by:
      authors in interface ModDisplayInfo
      Returns:
      the mod authors
    • credits

      public Component credits()
      Returns the credits. This is displayed if it is not an empty component. This pulls from the credits key of the mod info.
      Specified by:
      credits in interface ModDisplayInfo
      Returns:
      the credits
    • description

      public Component description()
      Returns the mod description. This is displayed if it is not an empty component. This uses the translation key neoforge.screen.mods.info.description.[modid] if available, falling back to the deprecated translation key fml.menu.mods.info.description.[modid] if available, where [modid] is the mod ID, with a fallback to the description key of the mod info.
      Specified by:
      description in interface ModDisplayInfo
      Returns:
      the mod description
    • license

      public Component license()
      Returns the mod license. This is always displayed, even if empty. This uses the license key of the mod file info. If the licenseURL key of the mod file info is set and is a valid URL, then this component has an open URL click action with that URL.
      Specified by:
      license in interface ModDisplayInfo
      Returns:
      the mod license
    • banner

      public @Nullable ImageResource banner()

      Returns the banner displayed in the info panel, or null.

      The banner is rendered with its original aspect ratio, bounded by the width of the info panel (ordinarily 250 pixels) and a maximum height of 50 pixels.

      This uses the `bannerFile` key of the mod info or, if not available, the mod file info.

      If bannerFile is not available in both, the same sources are searched for logoFile.

      Specified by:
      banner in interface ModDisplayInfo
      Returns:
      the banner displayed in the info panel, or null
      See Also:
    • icon

      public @Nullable ImageResource icon()

      Returns the icon displayed in the mod list, or null.

      The icon is rendered as a square with sides of 24 pixels.

      This uses the `iconFile` key of the mod info or, if not available, the mod file info.
      Specified by:
      icon in interface ModDisplayInfo
      Returns:
      the icon displayed in the mod list, or null
      See Also:
    • iconBlur

      public boolean iconBlur()
      Returns whether linear filtering should be used when scaling the icon. This uses the iconBlur key of the mod info or, if not available, the mod file info.
      Specified by:
      iconBlur in interface ModDisplayInfo
      Returns:
      whether linear filtering should be used when scaling the icon
    • convertPath

      public ImageResource convertPath(String path)

      Converts a given path string into an ImageResource.

      The logic for converting a path is as follows, in order:

      • If the path contains a pound sign (#), it is taken as a root resource with the parts before and after the pound sign taken as the pack ID and the resource path, respectively.
      • If the path has a colon (:), is it taken as a pack asset.
      • Otherwise, it is assumed to be a root resource with the mod's resource pack as determined by ResourcePackLoader.getPackName(IModFile).
      Parameters:
      path - the path to convert
      Returns:
      the image resource
    • displayUrl

      public @Nullable URI displayUrl()
      Returns the URL for the mod homepage, or null. If null, the homepage button is disabled. This uses the displayURL or, if not available, the modUrl key from the mod info.
      Specified by:
      displayUrl in interface ModDisplayInfo
      Returns:
      the URL for the mod homepage, or null
    • issuesUrl

      public @Nullable URI issuesUrl()
      Returns the URL for the mod issues page, or null. If null, the issues page button is disabled. This uses the issueTrackerURL key of the mod info or, if not available, the mod file info.
      Specified by:
      issuesUrl in interface ModDisplayInfo
      Returns:
      the URL for the mod issues page, or null
    • container

      public ModContainer container()
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object