net.minecraftforge.common.config.ConfigElement Java Examples

The following examples show how to use net.minecraftforge.common.config.ConfigElement. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OpenModsConfigScreen.java    From OpenModsLib with MIT License 6 votes vote down vote up
private static IConfigElement createConfigEntries(String modId) {
	final ModConfig config = ConfigProcessing.getConfig(modId);
	if (config == null) return null;

	final List<IConfigElement> categories = Lists.newArrayList();

	for (String category : config.getCategories()) {
		final List<IConfigElement> categoryEntries = Lists.newArrayList();
		for (String value : config.getValues(category)) {
			final ConfigPropertyMeta meta = config.getValue(category, value);
			categoryEntries.add(new ConfigElement(meta.getProperty()));
		}

		categories.add(new CategoryElement(category, "openmodslib.config.category." + category, categoryEntries));
	}

	return new CategoryElement("config", "openmodslib.config.config", categories, EntryWithWarning.class);
}
 
Example #2
Source File: OpenModsConfigScreen.java    From OpenModsLib with MIT License 6 votes vote down vote up
protected static IConfigElement createFeatureEntries(String modId) {
	final AbstractFeatureManager manager = FeatureRegistry.instance.getManager(modId);
	if (manager == null) return null;

	final List<IConfigElement> categories = Lists.newArrayList();

	for (String category : manager.getCategories()) {
		List<IConfigElement> categoryEntries = Lists.newArrayList();
		for (String feature : manager.getFeaturesInCategory(category)) {
			final Property property = FeatureRegistry.instance.getProperty(modId, category, feature);
			if (property != null) categoryEntries.add(new ConfigElement(property));
		}

		categories.add(new CategoryElement(category, "openmodslib.config.features." + category, categoryEntries));
	}

	return new CategoryElement("features", "openmodslib.config.features", categories);
}
 
Example #3
Source File: YouTubeConfigurationGui.java    From youtube-chat-for-minecraft with Apache License 2.0 5 votes vote down vote up
public YouTubeConfigurationGui(GuiScreen parentScreen) {
  super(
      parentScreen,
      new ConfigElement(
              YouTubeConfiguration.getInstance()
                  .getConfig()
                  .getCategory(Configuration.CATEGORY_GENERAL))
          .getChildElements(),
      YouTubeChat.MODID,
      false,
      false,
      "YouTube Chat");
}
 
Example #4
Source File: ConfigGuiFactory.java    From OpenPeripheral with MIT License 5 votes vote down vote up
private static IConfigElement createModConfig() {
	final Configuration config = OpenPeripheralCore.instance.config();
	final List<IConfigElement> result = Lists.newArrayList();

	for (String categoryName : config.getCategoryNames()) {
		if (!categoryName.equalsIgnoreCase(Config.CATEGORY_FEATURE_GROUPS)) {
			ConfigCategory category = config.getCategory(categoryName);
			result.add(new ConfigElement(category));
		}
	}

	return new DummyCategoryElement("modConfig", "openperipheralcore.config.miscConfig", result);
}
 
Example #5
Source File: GuiConfigHandler.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private static List<IConfigElement> getConfigElements(){
    List<IConfigElement> list = new ArrayList<IConfigElement>();
    for(String category : Config.CATEGORIES) {
        list.add(new DummyCategoryElement(category, category, new ConfigElement(Config.config.getCategory(category).setRequiresMcRestart(!Config.NO_MC_RESTART_CATS.contains(category))).getChildElements()));
    }

    return list;
}
 
Example #6
Source File: GuiConfigComplex.java    From LunatriusCore with MIT License 5 votes vote down vote up
private static List<IConfigElement> getConfigElements(final Configuration configuration, final String langPrefix) {
    final List<IConfigElement> elements = new ArrayList<IConfigElement>();
    for (final String name : configuration.getCategoryNames()) {
        final ConfigCategory category = configuration.getCategory(name).setLanguageKey(langPrefix + ".category." + name);
        if (category.parent == null) {
            elements.add(new ConfigElement(category));
        }
    }

    return elements;
}
 
Example #7
Source File: GuiConfigFactoryEnderZoo.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
  List<IConfigElement> list = new ArrayList<IConfigElement>();
  String prefix = "enderzoo.config.";

  for (Section section : Config.sections) {
    list.add(new ConfigElement(Config.config.getCategory(section.lc()).setLanguageKey(prefix + section.lang)));
  }

  return list;
}
 
Example #8
Source File: EMTGuiConfig.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new ConfigElement<ConfigCategory>(config.getCategory(CATEGORY_RANDOM.toLowerCase())));
    list.add(new ConfigElement<ConfigCategory>(config.getCategory(CATEGORY_VALUES.toLowerCase())));
    list.add(new ConfigElement<ConfigCategory>(config.getCategory(CATEGORY_RESEARCH.toLowerCase())));
    list.add(new ConfigElement<ConfigCategory>(config.getCategory(CATEGORY_OUTPUTS.toLowerCase())));
 list.add(new ConfigElement<ConfigCategory>(config.getCategory(CATEGORY_MODULES.toLowerCase())));

    return list;
}
 
Example #9
Source File: ModGuiConfig.java    From LetsModReboot with GNU General Public License v3.0 5 votes vote down vote up
public ModGuiConfig(GuiScreen guiScreen)
{
    super(guiScreen,
            new ConfigElement(ConfigurationHandler.configuration.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(),
            Reference.MOD_ID,
            false,
            false,
            GuiConfig.getAbridgedConfigPath(ConfigurationHandler.configuration.toString()));
}
 
Example #10
Source File: ConfigGui.java    From SimplyJetpacks with MIT License 5 votes vote down vote up
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
    List<IConfigElement> list = new ArrayList<IConfigElement>();
    String prefix = SimplyJetpacks.PREFIX + "config.";
    
    for (Section configSection : Config.configSections) {
        if (configSection.client) {
            list.add(new ConfigElement<ConfigCategory>(Config.configClient.getCategory(configSection.toLowerCase()).setLanguageKey(prefix + configSection.id)));
        } else {
            list.add(new ConfigElement<ConfigCategory>(Config.config.getCategory(configSection.toLowerCase()).setLanguageKey(prefix + configSection.id)));
        }
    }
    
    return list;
}
 
Example #11
Source File: EnderUtilitiesGuiFactory.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static List<IConfigElement> getConfigElements()
{
    List<IConfigElement> configElements = new ArrayList<IConfigElement>();

    Configuration config = ConfigReader.loadConfigsFromFile();
    configElements.add(new ConfigElement(config.getCategory(ConfigReader.CATEGORY_GENERIC)));
    configElements.add(new ConfigElement(config.getCategory(ConfigReader.CATEGORY_BUILDERSWAND)));
    configElements.add(new ConfigElement(config.getCategory(ConfigReader.CATEGORY_LISTS)));
    configElements.add(new ConfigElement(config.getCategory(ConfigReader.CATEGORY_CLIENT)));

    return configElements;
}
 
Example #12
Source File: AgriCraftGuiConfig.java    From AgriCraft with MIT License 5 votes vote down vote up
private static List<IConfigElement> getConfigElements() {
    List<IConfigElement> configElements = new ArrayList<>();
    for (AgriConfigCategory e : AgriConfigCategory.values()) {
        String descr = "AgriCraft " + e.getDisplayName() + " Settings";
        String name = "agricraft.configgui.ctgy." + e.name();
        configElements.add(new DummyConfigElement.DummyCategoryElement(descr, name, new ConfigElement(CoreHandler.getConfig().getCategory(e.name().toLowerCase())).getChildElements()));
    }
    return configElements;
}
 
Example #13
Source File: ConfigGui.java    From NEI-Integration with MIT License 5 votes vote down vote up
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
    List<IConfigElement> list = new ArrayList<IConfigElement>();
    String prefix = "neiintegration.config.";
    
    for (Section configSection : Config.configSections) {
        list.add(new ConfigElement<ConfigCategory>(Config.config.getCategory(configSection.toLowerCase()).setLanguageKey(prefix + configSection.id)));
    }
    
    return list;
}
 
Example #14
Source File: ConfigGuiFactory.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
@SuppressWarnings({ "rawtypes" })
private static List<IConfigElement> createConfigElements() {
	ConfigCategory modules = OpenPeripheralIntegration.instance.config().getCategory(OpenPeripheralIntegration.CATEGORY_MODULES);
	modules.setLanguageKey("openperipheralintegration.config.modules");
	final ConfigElement modulesElement = new ConfigElement(modules);
	return Lists.<IConfigElement> newArrayList(modulesElement);
}
 
Example #15
Source File: ModGuiConfig.java    From Fullscreen-Windowed-Minecraft with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ModGuiConfig (GuiScreen parentScreen)
{
    super(parentScreen,
            new ConfigElement(ConfigurationHandler.instance().getConfigurationCategory()).getChildElements(),
            Reference.MOD_ID,
            false,
            false,
            GuiConfig.getAbridgedConfigPath(ConfigurationHandler.instance().toString()));
}
 
Example #16
Source File: ConfigGUI.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
@SuppressWarnings({ "rawtypes" })
private static List<IConfigElement> getElements() {
	List<IConfigElement> list = new ArrayList<IConfigElement>();
	for (String category : ConfigurationHandler.INSTANCE.usedCategories)
		list.add(new ConfigElement(ConfigurationHandler.INSTANCE.configFile.getCategory(category)));
	return list;
}
 
Example #17
Source File: GuiConfigToroQuest.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
public GuiConfigToroQuest(GuiScreen parent) {
	super (parent, new ConfigElement(ConfigurationHandler.config.getCategory(Configuration.CATEGORY_CLIENT)).getChildElements(),
			ToroQuest.MODID,
			false,
			false,
			"ToroQuest");
	titleLine2 = ConfigurationHandler.config.getConfigFile().getAbsolutePath();
}
 
Example #18
Source File: GuiChiselConfig.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
public GuiChiselConfig(GuiScreen parent) {
	super(parent, new ConfigElement<ConfigCategory>(Configurations.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Chisel.MOD_ID, false, false, GuiConfig
			.getAbridgedConfigPath(Configurations.config.toString()));
}
 
Example #19
Source File: GuiChiselConfig.java    From Chisel with GNU General Public License v2.0 4 votes vote down vote up
public GuiChiselConfig(GuiScreen parent)
{
    super(parent, new ConfigElement(Configurations.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Chisel.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath(Configurations.config.toString()));
}
 
Example #20
Source File: GuiConfigSimple.java    From LunatriusCore with MIT License 4 votes vote down vote up
private static List<IConfigElement> getConfigElements(final Configuration configuration, final String categoryName) {
    final ConfigElement element = new ConfigElement(configuration.getCategory(categoryName));
    return element.getChildElements();
}
 
Example #21
Source File: NovaGuiConfig.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
public NovaGuiConfig(GuiScreen parentScreen, Configuration config, String modID) {
	super(parentScreen, new ConfigElement<>(config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(),
		modID, false, false, GuiConfig.getAbridgedConfigPath(config.toString()));
}
 
Example #22
Source File: ConfigGUI.java    From VersionChecker with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ConfigGUI(GuiScreen parent) {
    super(parent,
            new ConfigElement(ConfigHandler.configFile.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(),
            Reference.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath(ConfigHandler.configFile.toString()));
}
 
Example #23
Source File: NovaGuiConfig.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
public NovaGuiConfig(GuiScreen parentScreen, Configuration config, String modID) {
	super(parentScreen, new ConfigElement(config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), modID, false, false, GuiConfig.getAbridgedConfigPath(config.toString()));
}
 
Example #24
Source File: NovaGuiConfig.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
public NovaGuiConfig(GuiScreen parentScreen, Configuration config, String modID) {
	super(parentScreen, new ConfigElement(config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), modID, false, false, GuiConfig.getAbridgedConfigPath(config.toString()));
}
 
Example #25
Source File: SPConfigGUI.java    From Sound-Physics with GNU General Public License v3.0 4 votes vote down vote up
/** Creates a button linking to another screen where all options of the category are available */
private static IConfigElement categoryElement(String category, String name, String tooltip_key) 
{
    return new DummyConfigElement.DummyCategoryElement(name, tooltip_key,
            new ConfigElement(SoundPhysicsCore.configFile.getCategory(category)).getChildElements());
}