net.minecraftforge.client.gui

## Class ForgeGuiFactory

- java.lang.Object
- - net.minecraftforge.client.gui.ForgeGuiFactory

- All Implemented Interfaces:
    IModGuiFactory

      public class ForgeGuiFactory
      extends java.lang.Object
      implements IModGuiFactory

  This is the base GuiConfig screen class that all the other Forge-specific config screens will be called from. Since Forge has multiple config files I thought I would use that opportunity to show some of the ways that the config GUI system can be extended to create custom config GUIs that have additional features over the base functionality of just displaying Properties and ConfigCategories. The concepts implemented here are: - using custom IConfigEntry objects to define child-screens that have specific Properties listed - using custom IConfigEntry objects to define a dummy property that can be used to generate new ConfigCategory objects - defining the configID string for a GuiConfig object so that the config changed events will be posted when that GuiConfig screen is closed (the configID string is optional; if it is not defined the config changed events will be posted when the top-most GuiConfig screen is closed, eg when the parent is null or is not an instance of GuiConfig) - overriding the IConfigEntry.enabled() method to control the enabled state of one list entry based on the value of another entry - overriding the IConfigEntry.onGuiClosed() method to perform custom actions when the screen that owns the entry is closed (in this case a new ConfigCategory is added to the Configuration object) The config file structure looks like this: forge.cfg (general settings all in one category) forgeChunkLoading.cfg - Forge (category) - defaults (category) - [optional mod override categories]... The GUI structure is this: Base Screen - General Settings (from forge.cfg) - Chunk Loader Settings (from forgeChunkLoading.cfg) - Defaults (these elements are listed directly on this screen) - Mod Overrides - Add New Mod Override - Mod1 - Mod2 - etc. Other things to check out: ForgeModContainer.syncConfig() ForgeModContainer.onConfigChanged() ForgeChunkManager.syncConfigDefaults() ForgeChunkManager.loadConfiguration()

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ForgeGuiFactory.ForgeConfigGui`

    - ### Nested classes/interfaces inherited from interface cpw.mods.fml.client.IModGuiFactory

      `IModGuiFactory.RuntimeOptionCategoryElement, IModGuiFactory.RuntimeOptionGuiHandler`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ForgeGuiFactory()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `IModGuiFactory.RuntimeOptionGuiHandler` | `getHandlerFor(IModGuiFactory.RuntimeOptionCategoryElement element)` Return an instance of a `IModGuiFactory.RuntimeOptionGuiHandler` that handles painting the right hand side option screen for the specified `IModGuiFactory.RuntimeOptionCategoryElement`.
    `void` | `initialize(Minecraft minecraftInstance)` Called when instantiated to initialize with the active minecraft instance.
    `java.lang.Class<? extends GuiScreen>` | `mainConfigGuiClass()` Return the name of a class extending `GuiScreen`.
    `java.util.Set<IModGuiFactory.RuntimeOptionCategoryElement>` | `runtimeGuiCategories()` Return a list of the "runtime" categories this mod wishes to populate with GUI elements.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ForgeGuiFactory

          public ForgeGuiFactory()

  - ### Method Detail

    - #### initialize

          public void initialize(Minecraft minecraftInstance)

      Description copied from interface: `IModGuiFactory`
      Called when instantiated to initialize with the active minecraft instance.
      Specified by:
        `initialize` in interface `IModGuiFactory`
      Parameters:
        `minecraftInstance` - the instance

    - #### mainConfigGuiClass

          public java.lang.Class<? extends GuiScreen> mainConfigGuiClass()

      Description copied from interface: `IModGuiFactory`
      Return the name of a class extending `GuiScreen`. This class will be instantiated when the "config" button is pressed in the mod list. It will have a single argument constructor - the "parent" screen, the same as all Minecraft GUIs. The expected behaviour is that this screen will replace the "mod list" screen completely, and will return to the mod list screen through the parent link, once the appropriate action is taken from the config screen. A null from this method indicates that the mod does not provide a "config" button GUI screen, and the config button will be hidden/disabled. This config GUI is anticipated to provide configuration to the mod in a friendly visual way. It should not be abused to set internals such as IDs (they're gonna keep disappearing anyway), but rather, interesting behaviours. This config GUI is never run when a server game is running, and should be used to configure desired behaviours that affect server state. Costs, mod game modes, stuff like that can be changed here.
      Specified by:
        `mainConfigGuiClass` in interface `IModGuiFactory`
      Returns:
        A class that will be instantiated on clicks on the config button or null if no GUI is desired.

    - #### runtimeGuiCategories

          public java.util.Set<IModGuiFactory.RuntimeOptionCategoryElement> runtimeGuiCategories()

      Description copied from interface: `IModGuiFactory`
      Return a list of the "runtime" categories this mod wishes to populate with GUI elements. Runtime categories are created on demand and organized in a 'lite' tree format. The parent represents the parent node in the tree. There is one special parent 'Help' that will always list first, and is generally meant to provide Help type content for mods. The remaining parents will sort alphabetically, though this may change if there is a lot of alphabetic abuse. "AAA" is probably never a valid category parent. Runtime configuration itself falls into two flavours: in-game help, which is generally non interactive except for the text it wishes to show, and client-only affecting behaviours. This would include things like toggling minimaps, or cheat modes or anything NOT affecting the behaviour of the server. Please don't abuse this to change the state of the server in any way, this is intended to behave identically when the server is local or remote.
      Specified by:
        `runtimeGuiCategories` in interface `IModGuiFactory`
      Returns:
        the set of options this mod wishes to have available, or empty if none

    - #### getHandlerFor

          public IModGuiFactory.RuntimeOptionGuiHandler getHandlerFor(IModGuiFactory.RuntimeOptionCategoryElement element)

      Description copied from interface: `IModGuiFactory`
      Return an instance of a `IModGuiFactory.RuntimeOptionGuiHandler` that handles painting the right hand side option screen for the specified `IModGuiFactory.RuntimeOptionCategoryElement`.
      Specified by:
        `getHandlerFor` in interface `IModGuiFactory`
      Parameters:
        `element` - The element we wish to paint for
      Returns:
        The Handler for painting it