@Override protected GuiScreen buildChildScreen() { return new GuiConfig(this.owningScreen, this.configElement.getChildElements(), this.owningScreen.modID, owningScreen.allRequireWorldRestart || this.configElement.requiresWorldRestart(), owningScreen.allRequireMcRestart || this.configElement.requiresMcRestart(), this.owningScreen.title, I18n.format("openmodslib.config.update_warning")); }
private static Map<Object, String> getSelectableValues(IConfigElement configElement) { Map<Object, String> selectableValues = new TreeMap<>(); for (int i = 0; i < configElement.getValidValues().length; i++) { selectableValues.put(i, configElement.getValidValues()[i]); } return selectableValues; }
@Override protected GuiScreen buildChildScreen() { Configuration configuration = MBEConfiguration.getConfig(); ConfigElement cat_general = new ConfigElement(configuration.getCategory(MBEConfiguration.CATEGORY_NAME_OTHER)); List<IConfigElement> propertiesOnThisScreen = cat_general.getChildElements(); String windowTitle = configuration.toString(); return new GuiConfig(this.owningScreen, propertiesOnThisScreen, this.owningScreen.modID, MBEConfiguration.CATEGORY_NAME_OTHER, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, windowTitle); //this is a complicated object that specifies the category's gui screen, to better understand // how it works, look into the definitions of the called functions and objects } }
public static List<IConfigElement> getElements() { List<IConfigElement> elements = Lists.newArrayList(); elements.addAll(ConfigElement.from(ConfigHandler.class).getChildElements()); elements.add(new ConfigElement(BloodMagic.RITUAL_MANAGER.getConfig().getCategory("rituals"))); if (Minecraft.getMinecraft().world != null) elements.add(new DummyElementEditHUD(BloodMagic.NAME, "config." + BloodMagic.MODID + ".edit_hud")); return elements; }
@Override public List<IConfigElement> getChildElements() { List<IConfigElement> temp = super.getChildElements(); List<IConfigElement> ret = new ArrayList<IConfigElement>(temp.size()); for (IConfigElement e : temp) { if (e.isProperty()) { ret.add(new ConfigElementExtended(e)); } else { ret.add(new ConfigSection(section, prefix)); } } return ret; } }
@Override protected GuiScreen buildChildScreen() { //The following GuiConfig object specifies the configID of the object and thus will force-save // when closed. //Parent GuiConfig object's entryList will also be refreshed to reflect the changes. // --see GuiFactory of Forge for more info //Additionally, Forge best practices say to put the path to the config file for the category as // the title for the category config screen Configuration configuration = MBEConfiguration.getConfig(); ConfigElement cat_general = new ConfigElement(configuration.getCategory(MBEConfiguration.CATEGORY_NAME_GENERAL)); List<IConfigElement> propertiesOnThisScreen = cat_general.getChildElements(); String windowTitle = configuration.toString(); return new GuiConfig(this.owningScreen, propertiesOnThisScreen, this.owningScreen.modID, MBEConfiguration.CATEGORY_NAME_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart, this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, windowTitle); //this is a complicated object that specifies the category's gui screen, to better understand // how it works, look into the definitions of the called functions and objects } }
@Override public void updateValueButtonText() { super.updateValueButtonText(); btnValue.displayString = configElement.getValidValues()[Integer.parseInt(getCurrentValue())]; } }