Class ModConfig

java.lang.Object
net.neoforged.fml.config.ModConfig

public final class ModConfig extends Object
  • Field Details

    • type

      private final ModConfig.Type type
    • spec

      private final IConfigSpec spec
    • fileName

      private final String fileName
    • container

      final ModContainer container
    • loadedConfig

      @Nullable @Nullable LoadedConfig loadedConfig
    • lock

      final Lock lock
      NightConfig's own configs are threadsafe, but mod code is not necessarily. This lock is used to prevent multiple concurrent config reloads or event dispatches.
  • Constructor Details

  • Method Details

    • getType

      public ModConfig.Type getType()
    • getFileName

      public String getFileName()
    • getSpec

      public IConfigSpec getSpec()
    • getModId

      public String getModId()
    • getLoadedConfig

      @Nullable public IConfigSpec.ILoadedConfig getLoadedConfig()
      Retrieve the currently loaded config, for direct manipulation of the underlying CommentedConfig. Note that the config will change on reloads, and will be null when the config is not loaded.
    • getFullPath

      @Nullable public @Nullable Path getFullPath()
      Get the file path of the currently loaded config.
      Returns:
      The config's path. Will return null if the config is not currently loaded, or was loaded from memory rather than from a file.
    • setConfig

      void setConfig(@Nullable @Nullable LoadedConfig loadedConfig, Function<ModConfig,ModConfigEvent> eventConstructor)