Java Code Examples for net.minecraftforge.fml.client.config.IConfigElement

The following are top voted examples for showing how to use net.minecraftforge.fml.client.config.IConfigElement. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AuthlibLoginHelper   File: AuthlibLoginHelperGuiFactory.java   View source code 6 votes vote down vote up
private static List<IConfigElement> getConfigElements()
{
    PROPERTIES.clear();
    ImmutableList.Builder<IConfigElement> builder = ImmutableList.builder();
    Map<String, AuthlibLoginHelper.Data> accounts = AuthlibLoginHelper.getInstance().listAccounts();
    for (Map.Entry<String, AuthlibLoginHelper.Data> entry : accounts.entrySet())
    {
        String name = entry.getKey();
        AuthlibLoginHelper.Data data = entry.getValue();
        boolean skip = data.userid.isEmpty() && !data.accessToken.isPresent();

        String[] choices = skip ? SKIP_CHOICES.toArray(new String[0]) : LOGIN_CHOICES.toArray(new String[0]);
        Property property = new Property(name, choices[0], Property.Type.STRING, choices);
        property.setComment(skip ? SKIP_COMMENT : LOGIN_COMMENT);

        builder.add(new ConfigElement(property));
        PROPERTIES.put(name, property);
    }
    return builder.build();
}
 
Example 2
Project: CustomWorldGen   File: ForgeGuiFactory.java   View source code 6 votes vote down vote up
@Override
protected GuiScreen buildChildScreen()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new DummyCategoryElement("forgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingModConfig",
            ModOverridesEntry.class));
    list.addAll((new ConfigElement(ForgeChunkManager.getDefaultsCategory())).getChildElements());

    // This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent
    // GuiConfig object's propertyList will also be refreshed to reflect the changes.
    return new GuiConfig(this.owningScreen, list, this.owningScreen.modID, "chunkLoader",
            this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
            this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
            GuiConfig.getAbridgedConfigPath(ForgeChunkManager.getConfig().toString()),
            I18n.format("forge.configgui.ctgy.forgeChunkLoadingConfig"));
}
 
Example 3
Project: CustomWorldGen   File: ForgeGuiFactory.java   View source code 6 votes vote down vote up
/**
 * This method is called in the constructor and is used to set the childScreen field.
 */
@Override
protected GuiScreen buildChildScreen()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig",
            AddModOverrideEntry.class));
    for (ConfigCategory cc : ForgeChunkManager.getModCategories())
        list.add(new ConfigElement(cc));

    return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
            this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
            this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title,
            I18n.format("forge.configgui.ctgy.forgeChunkLoadingModConfig"));
}
 
Example 4
Project: CrystalMod   File: GuiConfigFactoryCM.java   View source code 6 votes vote down vote up
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
  List<IConfigElement> list = new ArrayList<IConfigElement>();
  String[] names = new String[]{
  		Config.CATEGORY_CLIENT,
  		Config.CATEGORY_WORLD,
  		Config.CATEGORY_ENTITY,
  		Config.CATEGORY_ITEM,
  		Config.CATEGORY_BLOCKS,
  		Config.CATEGORY_MACHINE,
  		Config.CATEGORY_MINIONS
  };
  for (String section : names) {
    list.add(new ConfigElement(CrystalMod.proxy.mainConfig.getCategory(section).setLanguageKey(Lang.prefix+"config." + section.toLowerCase())));
  }

  return list;
}
 
Example 5
Project: blockbuster   File: GuiConfig.java   View source code 6 votes vote down vote up
private static List<IConfigElement> getConfigElements()
{
    List<IConfigElement> elements = new ArrayList<IConfigElement>();

    for (String name : Blockbuster.proxy.forge.getCategoryNames())
    {
        ConfigCategory category = Blockbuster.proxy.forge.getCategory(name);
        category.setLanguageKey("blockbuster.config." + name + ".title");

        if (name.indexOf(".") == -1)
        {
            elements.add(new ConfigElement(category));
        }
    }

    return elements;
}
 
Example 6
Project: UncraftingTable   File: ModGuiConfig.java   View source code 6 votes vote down vote up
@Override
protected GuiScreen buildChildScreen()
{
	Configuration configuration = ModConfiguration.getConfig();
	ConfigElement configurationCategory = new ConfigElement(configuration.getCategory(ModConfiguration.CATEGORY_NUGGETS));
	List<IConfigElement> propertiesOnThisScreen = configurationCategory.getChildElements();
	String windowTitle = I18n.format("uncrafting.options.nuggets");

	return new GuiConfig(this.owningScreen, propertiesOnThisScreen,
		this.owningScreen.modID,
		ModConfiguration.CATEGORY_NUGGETS,
		this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
		this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
		windowTitle
	);

}
 
Example 7
Project: MC-Prefab   File: GuiPrefab.java   View source code 6 votes vote down vote up
private void ReplaceIntegerEntries()
{
	for (int i = 0; i < this.entryList.listEntries.size(); i++)
	{
		IConfigEntry entry = this.entryList.listEntries.get(i);
		IConfigElement element = entry.getConfigElement();

		if (element.getType() == ConfigGuiType.INTEGER)
		{
			TextNumberSliderEntry slider = new TextNumberSliderEntry(this, this.entryList, element);
			slider.updateValueButtonText();
			this.entryList.listEntries.set(i, slider);
			this.initEntries.set(i, slider);
		}
	}
}
 
Example 8
Project: MC-Prefab   File: GuiPrefab.java   View source code 6 votes vote down vote up
public TextNumberSliderEntry(GuiConfig owningScreen,
		GuiConfigEntries owningEntryList, IConfigElement configElement) 
{
	super(owningScreen, owningEntryList, configElement, new GuiTextSlider(0, owningEntryList.controlX, 0, owningEntryList.controlWidth, 18,
			"", "", Double.valueOf(configElement.getMinValue().toString()), Double.valueOf(configElement.getMaxValue().toString()),
			Double.valueOf(configElement.get().toString()), configElement.getType() == ConfigGuiType.DOUBLE, true));

	((GuiTextSlider)this.btnValue).parentEntry = this;

	if (configElement.getType() == ConfigGuiType.INTEGER)
	{
		this.beforeValue = Integer.valueOf(configElement.get().toString());
	}
	else
	{
		this.beforeValue = Double.valueOf(configElement.get().toString());
	}
}
 
Example 9
Project: Toms-Mod   File: ModGuiConfigHUD.java   View source code 6 votes vote down vote up
public ModGuiConfigHUD(GuiScreen parentScreen, List<IConfigElement> configElements, String modID, String configID, boolean allRequireWorldRestart, boolean allRequireMcRestart, String title, String Config) {
	super(parentScreen, configElements, modID, configID, allRequireWorldRestart, allRequireMcRestart, title, "Use right click and hold to move the map");

	if (Config.equals(Reference.catFullMapConfig)) {
		dummyMapConfig = new MapModeConfig(Reference.catFullMapConfig);
	} else if (Config.equals(Reference.catLargeMapConfig)) {
		dummyMapConfig = new LargeMapModeConfig(Reference.catLargeMapConfig);
	} else if (Config.equals(Reference.catSmallMapConfig)) {
		dummyMapConfig = new SmallMapModeConfig(Reference.catSmallMapConfig);
	}
	dummyMapConfig.setDefaults();
	dummyMapConfig.loadConfig();

	this.mw = Mw.getInstance();
	this.mapMode = new MapMode(dummyMapConfig);
	this.map = new MapRenderer(this.mw, this.mapMode, null);
}
 
Example 10
Project: HarvestTweaks   File: ConfigFieldEntry.java   View source code 6 votes vote down vote up
public ConfigFieldEntry(String name, String langKey, Class<?> clazz, Object instance, Map<Object, Object> parent) {
  super(name, null, getType(clazz), langKey);

  this.instance = instance;
  this.parent = parent;

  if(Map.class.isAssignableFrom(clazz)) {
    this.isProperty = false;
    ImmutableList.Builder<IConfigElement> builder = ImmutableList.builder();
    Map<Object, Object> map = ((Map<Object, Object>) instance);
    map.forEach((o, o2) -> builder.add(new ConfigFieldEntry(o.toString(), o.toString() + ".lang", o2.getClass(), o2, map)));
    this.childElements = builder.build();
    this.configEntryClass = GuiConfigEntries.CategoryEntry.class;
  }
  else {
    this.defaultValue = instance.toString();
    this.setToDefault();
  }
}
 
Example 11
Project: JustEnoughButtons   File: GuiJEBConfig.java   View source code 6 votes vote down vote up
public static List<IConfigElement> getElements() {
    buttonorder.clear();
    for (int i = 0; i < JEIButtons.btnCustom.length; i++) {
        buttonorder.add("enableCustomButton." + i);
        buttonorder.add("customName." + i);
        buttonorder.add("customCommand." + i);
    }

    List<IConfigElement> entries = new ArrayList<IConfigElement>();

    for (String name : ConfigHandler.config.getCategoryNames())
        if (name.equals(ConfigHandler.CATEGORY_CUSTOM))
            entries.add(new ConfigElement(ConfigHandler.config.getCategory(name).setPropertyOrder(buttonorder)));
        else
            entries.add(new ConfigElement(ConfigHandler.config.getCategory(name)));


    return entries;
}
 
Example 12
Project: Talismans2   File: TalismanConfigGUI.java   View source code 6 votes vote down vote up
private static List<IConfigElement> getConfigCategories()
{
	List<IConfigElement> list = new ArrayList<IConfigElement>();
	list.add(new DummyConfigElement.DummyCategoryElement("Spawn Chances",
			"tm2.configgui.category.tmGeneral", (Class<? extends IConfigEntry>) TMGeneral.class));
	list.add(new DummyConfigElement.DummyCategoryElement(
			"Loot Spawn Chances", "tm2.configgui.category.tmLoot",
			(Class<? extends IConfigEntry>) TMLoot.class));
	list.add(new DummyConfigElement.DummyCategoryElement(
			"Configure Boolean Recipes",
			"tm2.configgui.category.tmRecipes", (Class<? extends IConfigEntry>) TMRecipes.class));
	list.add(new DummyConfigElement.DummyCategoryElement(
			"Blood Magic Integration",
			"tm2.configgui.category.tmBloodMagic", (Class<? extends IConfigEntry>) TMBloodMagic.class));
	list.add(new DummyConfigElement.DummyCategoryElement(
			"Thaumcraft Integration",
			"tm2.configgui.category.tmThaumcraft", (Class<? extends IConfigEntry>) TMTC.class));
	list.add(new DummyConfigElement.DummyCategoryElement(
			"Botania Integration", "tm2.configgui.category.tmBotania",
			(Class<? extends IConfigEntry>) TMBotania.class));
	return list;
}
 
Example 13
Project: minema   File: MinemaConfigGui.java   View source code 6 votes vote down vote up
private static List<IConfigElement> getConfigElements(Configuration config) {
    // map config elements to their categories, except for CATEGORY_GENERAL
    List<IConfigElement> list = config.getCategoryNames().stream()
        .filter(catName -> !catName.equals(Configuration.CATEGORY_GENERAL))
        .map(catName -> new ConfigElement(config.getCategory(catName)))
        .collect(Collectors.toList());

    // add props in CATEGORY_GENERAL directly to the root of the list
    if (config.hasCategory(Configuration.CATEGORY_GENERAL)) {
        ConfigCategory catGeneral = config.getCategory(Configuration.CATEGORY_GENERAL);
        List<Property> props = catGeneral.getOrderedValues();            
        list.addAll(props.stream()
            .map(prop -> new ConfigElement(prop))
            .collect(Collectors.toList())
        );
    }

    return list;
}
 
Example 14
Project: ClicketyClack   File: KeyFilterConfig.java   View source code 6 votes vote down vote up
public static IConfigElement createConfigurationCategory(Configuration config) {
    final Property property = getProperty(config);

    final TIntSet values = new TIntHashSet(property.getIntList());

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

    for (int keyCode = 0; keyCode < Keyboard.KEYBOARD_SIZE; keyCode++) {
        final String keyName = Keyboard.getKeyName(keyCode);
        if (keyName != null)
            filterList.add(new FlagArrayElement(property, values, keyCode, keyName));
    }

    final ConfigCategory category = config.getCategory(ConfigValues.CATEGORY_KEY_FILTER);
    return new DummyCategoryElement(category.getName(), category.getLanguagekey(), filterList);
}
 
Example 15
Project: OpenModsLib   File: OpenModsConfigScreen.java   View source code 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 16
Project: OpenModsLib   File: OpenModsConfigScreen.java   View source code 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 17
Project: EnderIO   File: GuiConfigFactoryEIO.java   View source code 6 votes vote down vote up
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
  List<IConfigElement> result = new ArrayList<>();
  List<ModContainer> modList = Loader.instance().getModList();
  for (ModContainer modContainer : modList) {
    Object mod = modContainer.getMod();
    if (mod instanceof IEnderIOAddon) {
      Configuration configuration = ((IEnderIOAddon) mod).getConfiguration();
      if (configuration != null) {
        List<IConfigElement> list = new ArrayList<>();
        for (String section : configuration.getCategoryNames()) {
          list.add(new ConfigElement(configuration.getCategory(section).setLanguageKey(EnderIO.lang.addPrefix("config." + section))));
        }
        result.add(new DummyCategoryElement(modContainer.getName(), EnderIO.lang.addPrefix("config.title." + modContainer.getModId()), list));
      }
    }
  }

  return result;
}
 
Example 18
Project: CreeperHostGui   File: GuiCreeperConfig.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements()
{
    final Config defaultConfig = new Config();

    List<IConfigElement> array = new ArrayList<IConfigElement>();
    Field[] fields = Config.class.getDeclaredFields();
    for (Field field : fields)
    {
        if (Modifier.isTransient(field.getModifiers()) || Modifier.isStatic(field.getModifiers()))
        {
            continue;
        }
        Object defValue = null;
        try
        {
            field.setAccessible(true);
            defValue = field.get(defaultConfig);

        }
        catch (Throwable t)
        {
        }

        array.add(new ReflectionConfigElement(field, defValue));
    }
    return array;
}
 
Example 19
Project: VillagerInventory   File: ModGuiConfigEntries.java   View source code 5 votes vote down vote up
public BooleanEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement)
{
	super(owningScreen, owningEntryList, configElement);
	this.beforeValue = Boolean.valueOf(configElement.get().toString());
	this.currentValue = this.beforeValue;
	this.btnValue.enabled = this.enabled();
	this.updateValueButtonText();
}
 
Example 20
Project: Geolosys   File: ConfigGUI.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements()
{
    ArrayList<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new ConfigElement(Config.getInstance().FeatureControl));
    list.add(new ConfigElement(Config.getInstance().Samples));
    list.add(new ConfigElement(Config.getInstance().UserEntries));

    return list;
}
 
Example 21
Project: DankNull   File: GuiModConfig.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements() {
	List<IConfigElement> configElements = new ArrayList<IConfigElement>();
	Configuration config = ModConfig.CONFIG;
	if (config != null) {
		ConfigCategory categoryClient = config.getCategory(ModConfig.CLIENT_CAT);
		configElements.addAll(new ConfigElement(categoryClient).getChildElements());
	}
	return configElements;
}
 
Example 22
Project: GardenStuff   File: ModConfigGui.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements () {
    List<IConfigElement> list = new ArrayList<>();

    //for (ConfigManager.ConfigSection section : StorageDrawers.config.sections)
    //    list.add(new ConfigElement(section.getCategory()));

    return list;
}
 
Example 23
Project: VanillaExtras   File: VExGuiFactory.java   View source code 5 votes vote down vote up
@Override
protected GuiScreen buildChildScreen() {
	Configuration config = VExConfig.getConfig();
	ConfigElement categoryBlocks = new ConfigElement(config.getCategory(VExConfig.CATEGORY_NAME_BLOCKS));
	List<IConfigElement> propertiesOnScreen = categoryBlocks.getChildElements();
	String windowTitle = I18n.format("gui.config.category.blocks");
	return new GuiConfig(owningScreen, propertiesOnScreen, owningScreen.modID,
			this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
			this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, windowTitle);
}
 
Example 24
Project: refinedstorageaddons   File: RSAddonsConfig.java   View source code 5 votes vote down vote up
@SuppressWarnings("unchecked")
public List<IConfigElement> getConfigElements() {
    List<IConfigElement> list = new ArrayList<>();

    list.addAll(new ConfigElement(config.getCategory(NETWORK_PICKER)).getChildElements());
    list.addAll(new ConfigElement(config.getCategory(NETWORK_BAG)).getChildElements());
    list.addAll(new ConfigElement(config.getCategory(INFINITE_WIRELESS_TRANSMITTER)).getChildElements());
    list.addAll(new ConfigElement(config.getCategory(WIRELESS_CRAFTING_GRID)).getChildElements());

    return list;
}
 
Example 25
Project: EndermanEvolution   File: GuiModConfig.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements() {
	List<IConfigElement> configElements = new ArrayList<IConfigElement>();
	Configuration config = ModConfig.CONFIG;
	if (config != null) {
		ConfigCategory categoryClient = config.getCategory(ModConfig.CLIENT_CAT);
		configElements.addAll(new ConfigElement(categoryClient).getChildElements());
	}
	return configElements;
}
 
Example 26
Project: ItemZoom   File: ItemZoomModConfigGui.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements() {
	List<IConfigElement> configElements = new ArrayList<IConfigElement>();

	Configuration config = Config.getConfig();
	if (config != null) {
		ConfigCategory category = config.getCategory(Config.getCategory());
		configElements.addAll(new ConfigElement(category).getChildElements());
	}

	return configElements;
}
 
Example 27
Project: Sound-Physics   File: SPConfigGUI.java   View source code 5 votes vote down vote up
/** Compiles a list of config elements */
private static List<IConfigElement> getConfigElements() 
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();
  
    //Add categories to config GUI
    list.add(categoryElement(SoundPhysicsCore.configFile.CATEGORY_GENERAL, "General", "soundphysics.configgui.ctgy.general"));
    list.add(categoryElement(SoundPhysicsCore.Config.categoryPerformance, "Performance", "soundphysics.configgui.ctgy.performance"));
    list.add(categoryElement(SoundPhysicsCore.Config.categoryMaterialProperties, "Material Properties", "soundphysics.configgui.ctgy.materialProperties"));
    list.add(categoryElement(SoundPhysicsCore.Config.categoryMisc, "Misc", "soundphysics.configgui.ctgy.misc"));
  
    return list;
}
 
Example 28
Project: TheOink   File: OinkConfig.java   View source code 5 votes vote down vote up
public static List<IConfigElement> getEntries() {
    List<IConfigElement> entries = new ArrayList<IConfigElement>();
    Set<String> categories = config.getCategoryNames();
    Iterator<String> i = categories.iterator();
    while (i.hasNext()) {
        String categoryName = i.next();
        ConfigCategory category = config.getCategory(categoryName);
        entries.addAll(new ConfigElement(category).getChildElements());
    }
    return entries;
}
 
Example 29
Project: Mods   File: TF2GuiConfig.java   View source code 5 votes vote down vote up
public static List<IConfigElement> getElements() {
	ArrayList<IConfigElement> configElements = new ArrayList<>();
	configElements.add(new ConfigElement(TF2weapons.conf.getCategory("modcompatibility")));
	configElements.add(new ConfigElement(TF2weapons.conf.getCategory("spawn rate")));
	configElements.add(new ConfigElement(TF2weapons.conf.getCategory("world gen")));
	configElements.add(new ConfigElement(TF2weapons.conf.getCategory("default building targets")));
	configElements.add(new ConfigElement(TF2weapons.conf.getCategory("sound volume")));
	configElements.addAll(new ConfigElement(TF2weapons.conf.getCategory("gameplay")).getChildElements());
	return configElements;
	
	
	/*List<IConfigElement> list = new ConfigElement(TF2weapons.conf.getCategory("gameplay")).getChildElements();
	list.addAll(new ConfigElement(TF2weapons.conf.getCategory("modcompatibility")).getChildElements());
	return list;*/
}
 
Example 30
Project: CustomWorldGen   File: ForgeGuiFactory.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();
    list.add(new DummyCategoryElement("forgeCfg", "forge.configgui.ctgy.forgeGeneralConfig", GeneralEntry.class));
    list.add(new DummyCategoryElement("forgeClientCfg", "forge.configgui.ctgy.forgeClientConfig", ClientEntry.class));
    list.add(new DummyCategoryElement("forgeChunkLoadingCfg", "forge.configgui.ctgy.forgeChunkLoadingConfig", ChunkLoaderEntry.class));
    list.add(new DummyCategoryElement("forgeVersionCheckCfg", "forge.configgui.ctgy.VersionCheckConfig", VersionCheckEntry.class));
    return list;
}
 
Example 31
Project: CustomWorldGen   File: ForgeGuiFactory.java   View source code 5 votes vote down vote up
@Override
protected GuiScreen buildChildScreen()
{
    ConfigCategory cfg = ForgeModContainer.getConfig().getCategory(VERSION_CHECK_CAT);
    Map<String, Property> values = new HashMap<String, Property>(cfg.getValues());
    values.remove("Global");

    Property global = ForgeModContainer.getConfig().get(VERSION_CHECK_CAT, "Global", true);

    List<Property> props = new ArrayList<Property>();

    for (ModContainer mod : ForgeVersion.gatherMods().keySet())
    {
        values.remove(mod.getModId());
        props.add(ForgeModContainer.getConfig().get(VERSION_CHECK_CAT, mod.getModId(), true)); //Get or make the value in the config
    }
    props.addAll(values.values()); // Add any left overs from the config
    Collections.sort(props, new Comparator<Property>()
    {
        @Override
        public int compare(Property o1, Property o2)
        {
            return o1.getName().compareTo(o2.getName());
        }
    });

    List<IConfigElement> list = new ArrayList<IConfigElement>();
    list.add(new ConfigElement(global));
    for (Property prop : props)
    {
        list.add(new ConfigElement(prop));
    }

    // This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent
    // GuiConfig object's propertyList will also be refreshed to reflect the changes.
    return new GuiConfig(this.owningScreen,
            list,
            this.owningScreen.modID, VERSION_CHECK_CAT, true, true,
            GuiConfig.getAbridgedConfigPath(ForgeModContainer.getConfig().toString()));
}
 
Example 32
Project: CustomWorldGen   File: ForgeGuiFactory.java   View source code 5 votes vote down vote up
@Override
protected GuiScreen buildChildScreen()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new DummyConfigElement("modID", "", ConfigGuiType.STRING, "forge.configgui.modID").setCustomListEntryClass(ModIDEntry.class));
    list.add(new ConfigElement(new Property("maximumTicketCount", "200", Property.Type.INTEGER, "forge.configgui.maximumTicketCount")));
    list.add(new ConfigElement(new Property("maximumChunksPerTicket", "25", Property.Type.INTEGER, "forge.configgui.maximumChunksPerTicket")));

    return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
            this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
            this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title,
            I18n.format("forge.configgui.ctgy.forgeChunkLoadingAddModConfig"));
}
 
Example 33
Project: mves   File: GuiConfigFactory.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
  List<IConfigElement> list = new ArrayList<IConfigElement>();
  String prefix = MvesMod.MODID + ".config.";

  for (Section section : Section.values()) {
    if (!section.sync || !CONFIGHANDLER.configLockedByServer) {
      list.add(new ConfigElement(CONFIGHANDLER.configuration.getCategory(section.name).setLanguageKey(prefix + section.name)));
    }
  }

  return list;
}
 
Example 34
Project: metamorph   File: GuiConfig.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements()
{
    List<IConfigElement> elements = new ArrayList<IConfigElement>();

    for (String name : Metamorph.proxy.forge.getCategoryNames())
    {
        ConfigCategory category = Metamorph.proxy.forge.getCategory(name);

        category.setLanguageKey("metamorph.config." + name + ".title");
        elements.add(new ConfigElement(category));
    }

    return elements;
}
 
Example 35
Project: TravelHut   File: GuiConfigFactory.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
  List<IConfigElement> list = new ArrayList<IConfigElement>();
  String prefix = TravelHutMod.MODID + ".config.";

  for (Section section : Section.values()) {
    if (!section.sync || !ConfigHandler.configLockedByServer) {
      list.add(new ConfigElement(ConfigHandler.configuration.getCategory(section.name).setLanguageKey(prefix + section.name)));
    }
  }

  return list;
}
 
Example 36
Project: ItsJustaCharm1.10.2Dead   File: ModConfigGui.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigCategories() {

		List<IConfigElement> categories = new ArrayList<IConfigElement>();

		for (String category : ModConfig.configuration.getCategoryNames()) {
			ConfigCategory cc = ModConfig.configuration.getCategory(category);
			if (cc.isChild()) continue;
			ConfigElement ce = new ConfigElement(cc);
			categories.add(ce);
		}
		return categories;
	}
 
Example 37
Project: ShearMadness   File: ConfigGUI.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements()
{
    final List<IConfigElement> configElements = Lists.newArrayList();

    final Configuration config = ConfigurationHandler.INSTANCE.getConfig();
    final ConfigElement general = new ConfigElement(config.getCategory(Configuration.CATEGORY_GENERAL));
    configElements.addAll(general.getChildElements());

    return configElements;
}
 
Example 38
Project: placementpreview   File: PlacementPreviewGuiFactory.java   View source code 5 votes vote down vote up
private static List<IConfigElement> getConfigElements()
{
    List<IConfigElement> configElements = new ArrayList<IConfigElement>();

    configElements.add(new ConfigElement(Configs.getConfiguration().getCategory(Configs.CATEGORY_GENERIC)));
    configElements.add(new ConfigElement(Configs.getConfiguration().getCategory(Configs.CATEGORY_LISTS)));

    return configElements;
}
 
Example 39
Project: accesstweaks   File: ConfigGui.java   View source code 5 votes vote down vote up
/** Constructs a list of all config elements needed for the gui. */
private static List<IConfigElement> getConfigElements() {
    
    List<IConfigElement> result = new ArrayList<IConfigElement>();
  
    result.add(getChildren(Portals.CONFIG_PORTALS, "Nether portals"));
    result.add(getChildren(Particles.CONFIG_PARTICLES, "Particles"));
    result.add(getChildren(Sounds.CONFIG_SOUNDS, "Sounds and Subtitles"));
    result.add(getChildren(Maxbright.CONFIG_MAXBRIGHT, "Max Brightness"));
    
    return result;
}
 
Example 40
Project: accesstweaks   File: ConfigGui.java   View source code 5 votes vote down vote up
/** Gets the sub elements for a config category. */
private static IConfigElement getChildren(String category, String name) {
    
    return new DummyConfigElement.DummyCategoryElement(name, name,
            new ConfigElement(Accesstweaks.config.getCategory(category))
            .getChildElements());
}