Interface Config

All Known Implementing Classes:
ConfigImpl

public interface Config
  • Method Details

    • builder

      static ConfigBuilder builder(String namespace)
      This is the entrypoint for starting to build a config and all its tabs, properties and widgets.
      Parameters:
      namespace - The namespace to identify the config. This should be your mod id.
      Returns:
      The config builder.
    • createTab

      ConfigTabBuilder createTab(String name)
      Creates a new tab for the config. Use this if you want to split your config into multiple tabs.
      Parameters:
      name - The name of the tab
      Returns:
      A new config tab builder
    • createDefaultTab

      ConfigTabBuilder createDefaultTab()
      Creates the default tab for the config. Use this if you don't want to use multiple tabs for your config. This will create the single default tab to which you can add all your properties.
      Returns:
      The default config tab builder
    • createScreen

      @Deprecated ConfigScreen createScreen(@Nullable @Nullable net.minecraft.client.gui.screen.Screen parent)
      Deprecated.
      Creates a screen for the config. Use this with MinecraftClient.setScreen(Screen) to show the config screen.
      Parameters:
      parent - The parent screen to return to when closing the config screen
      Returns:
      The config screen
    • save

      void save()
      Saves the config to a file using the Serializer defined in the config.
    • load

      void load()
      Loads the config from a file using the Serializer defined in the config.
    • isDirty

      boolean isDirty()
      Returns:
      Whether any property has been changed since the config was last saved.
    • saveIfDirty

      void saveIfDirty()
      Saves the config only if any property has been changed since last saving.
    • scheduleSave

      void scheduleSave(Duration duration)
      Schedules a call to saveIfDirty() with the specified delay. If this method is called again during that delay, the old delay is overridden and the time starts again. That makes it useful for debouncing repeated modification of a property from user input outside a config screen. If this method is invoked after every change of a property, it will only be saved once, assuming the delay is set longer than the gaps between property changes.