Interface ISortableConfigValueFactory


@NonExtendable public interface ISortableConfigValueFactory
Creates config values for sortable value lists that are discovered at runtime.

Prefer adding sorting configs directly with IConfigScreenCategoryBuilder.addSortingConfig(String, String, ISortingConfig, Collection, IConfigValueSerializer) or IConfigScreenCategoryBuilder.addStringSortingConfig(String, String, ISortingConfig, Collection) when customizing a screen category. This factory remains for callers that still need to create a screen value explicitly.

Since:
0.1.0
  • Method Details

    • create

      <T> IConfigScreenValue<List<T>> create(String name, String localizationKey, net.mezzdev.config.api.sorting.ISortingConfig<T> sortingConfig, Collection<T> values, net.mezzdev.config.api.value.serializer.IConfigValueSerializer<T> valueSerializer)
      Create a config value for editing a runtime value list backed by a sorting config.

      The given values are copied when this method is called. The sorting config keeps owning storage and sorting behavior; this config value only adapts it for the config GUI list editor.

      Parameters:
      name - stable config value name
      localizationKey - translation key for this config value's name
      sortingConfig - sorting config that stores and applies the edited order
      values - complete runtime value set to expose in the list editor
      valueSerializer - serializer and display metadata for one list value
      Returns:
      a config screen value for the sortable runtime list
      Since:
      0.1.0
    • create

      <T> IConfigScreenValue<List<T>> create(String name, String localizationKey, net.mezzdev.config.api.sorting.ISortingConfig<T> sortingConfig, Collection<T> values, net.mezzdev.config.api.value.serializer.IConfigValueSerializer<T> valueSerializer, ConfigValueApplyMode applyMode)
      Create a config value for editing a runtime value list backed by a sorting config.

      The given values are copied when this method is called. The sorting config keeps owning storage and sorting behavior; this config value only adapts it for the config GUI list editor.

      Parameters:
      name - stable config value name
      localizationKey - translation key for this config value's name
      sortingConfig - sorting config that stores and applies the edited order
      values - complete runtime value set to expose in the list editor
      valueSerializer - serializer and display metadata for one list value
      applyMode - when saved order edits are written
      Returns:
      a config screen value for the sortable runtime list
      Since:
      0.1.0
    • createStringList

      IConfigScreenValue<List<String>> createStringList(String name, String localizationKey, net.mezzdev.config.api.sorting.ISortingConfig<String> sortingConfig, Collection<String> values, Map<String,net.minecraft.network.chat.Component> valueNames, Map<String,net.minecraft.network.chat.Component> valueDescriptions, Map<String,IConfigValueIcon> valueIcons)
      Create a string-list config value for editing a runtime value list backed by a sorting config.
      Parameters:
      name - stable config value name
      localizationKey - translation key for this config value's name
      sortingConfig - sorting config that stores and applies the edited order
      values - complete runtime value set to expose in the list editor
      valueNames - display names for list values
      valueDescriptions - optional descriptions for list values
      valueIcons - optional icons for list values
      Returns:
      a config screen value for the sortable runtime list
      Since:
      0.1.0
    • createStringList

      IConfigScreenValue<List<String>> createStringList(String name, String localizationKey, net.mezzdev.config.api.sorting.ISortingConfig<String> sortingConfig, Collection<String> values, Map<String,net.minecraft.network.chat.Component> valueNames, Map<String,net.minecraft.network.chat.Component> valueDescriptions, Map<String,IConfigValueIcon> valueIcons, ConfigValueApplyMode applyMode)
      Create a string-list config value for editing a runtime value list backed by a sorting config.
      Parameters:
      name - stable config value name
      localizationKey - translation key for this config value's name
      sortingConfig - sorting config that stores and applies the edited order
      values - complete runtime value set to expose in the list editor
      valueNames - display names for list values
      valueDescriptions - optional descriptions for list values
      valueIcons - optional icons for list values
      applyMode - when saved order edits are written
      Returns:
      a config screen value for the sortable runtime list
      Since:
      0.1.0