net.minecraftforge.common.config.ConfigCategory Java Examples

The following examples show how to use net.minecraftforge.common.config.ConfigCategory. 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: ListManager.java    From TickDynamic with MIT License 6 votes vote down vote up
private void loadLocalGroups() {
	//Add local groups from config
	ConfigCategory config = mod.getWorldConfigCategory(world);
	Iterator<ConfigCategory> localIt;
	for(localIt = config.getChildren().iterator(); localIt.hasNext(); )
	{
		ConfigCategory localGroupCategory = localIt.next();
		String name = localGroupCategory.getName();
		EntityGroup localGroup = mod.getWorldEntityGroup(world, name, entityType, true, true);
		if(localGroup.getGroupType() != entityType || localGroups.contains(localGroup))
			continue;

		if(mod.debug)
			System.out.println("Load local group: " + name);
		localGroups.add(localGroup);
		localGroup.list = this;
	}
}
 
Example #2
Source File: ListManager.java    From TickDynamic with MIT License 6 votes vote down vote up
private void loadGlobalGroups() {
	ConfigCategory config = mod.config.getCategory("groups");
	Iterator<ConfigCategory> globalIt;
	for(globalIt = config.getChildren().iterator(); globalIt.hasNext(); )
	{
		ConfigCategory groupCategory = globalIt.next();
		String name = groupCategory.getName();
		EntityGroup globalGroup = mod.getEntityGroup("groups." + name);

		if(globalGroup == null || globalGroup.getGroupType() != entityType)
			continue;

		//Get or create the local group as a copy of the global, but without a world config entry.
		//Will inherit config from the global group.
		EntityGroup localGroup = mod.getWorldEntityGroup(world, name, entityType, true, false);
		if(localGroups.contains(localGroup))
			continue; //Local group already defined

		if(mod.debug)
			System.out.println("Load global group: " + name);
		localGroups.add(localGroup);
		localGroup.list = this;
	}
}
 
Example #3
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 #4
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 #5
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 #6
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 #7
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 #8
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 #9
Source File: TickDynamicMod.java    From TickDynamic with MIT License 4 votes vote down vote up
public ConfigCategory getWorldConfigCategory(World world) {
	return config.getCategory(getWorldPrefix(world));
}
 
Example #10
Source File: ConfigurationHandler.java    From Fullscreen-Windowed-Minecraft with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConfigCategory getConfigurationCategory()
{
    return _configuration.getCategory(Configuration.CATEGORY_GENERAL);
}
 
Example #11
Source File: OpenPeripheralIntegration.java    From OpenPeripheral-Integration with MIT License 4 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent evt) {
	config = new Configuration(evt.getSuggestedConfigurationFile());

	if (config.hasCategory("integration")) {
		ConfigCategory integration = config.getCategory("integration");
		config.removeCategory(integration);
	}

	if (checkConfig(config, "vanilla")) Integration.addModule(new ModuleVanilla());
	if (checkConfig(config, "vanilla-inventory")) Integration.addModule(new ModuleVanillaInventory());
	if (checkConfig(config, "vanilla-inventory-manipulation")) Integration.addModule(new ModuleVanillaInventoryManipulation());

	if (checkConfig(config, "cofh-api-energy")) Integration.addModule(new ModuleCofhEnergy());
	if (checkConfig(config, "cofh-api-inventory")) Integration.addModule(new ModuleCofhInventory());
	if (checkConfig(config, "cofh-api-item")) Integration.addModule(new ModuleCofhItem());
	if (checkConfig(config, "cofh-api-tileentity")) Integration.addModule(new ModuleCofhTileEntity());
	if (checkConfig(config, "cofh-api-transport")) Integration.addModule(new ModuleCofhTransport());

	if (checkConfig(config, "buildcraft-api-transport")) Integration.addModule(new ModuleBuildCraftTransport());
	if (checkConfig(config, "buildcraft-api-tilenentity")) Integration.addModule(new ModuleBuildCraftTile());
	if (checkConfig(config, "buildcraft-api-facades")) Integration.addModule(new ModuleBuildCraftFacades());

	if (checkConfig(config, "ic2-mod")) Integration.addModule(new ModuleIC2());
	if (checkConfig(config, "ic2-api")) Integration.addModule(new ModuleIC2Api());

	if (checkConfig(config, "railcraft-mod")) Integration.addModule(new ModuleRailcraft());
	if (checkConfig(config, "railcraft-api-carts")) Integration.addModule(new ModuleRailcraftCarts());
	if (checkConfig(config, "railcraft-api-fuel")) Integration.addModule(new ModuleRailcraftFuel());

	if (checkConfig(config, "thaumcraft-mod")) Integration.addModule(new ModuleThaumcraft());
	if (checkConfig(config, "thaumcraft-api")) Integration.addModule(new ModuleThaumcraftApi());

	if (checkConfig(config, "mfr-mod")) Integration.addModule(new ModuleMinefactoryReloaded());
	if (checkConfig(config, "mfr-mod-storage")) Integration.addModule(new ModuleMinefactoryReloadedStorage());

	if (checkConfig(config, "computercraft-mod")) Integration.addModule(new ModuleComputerCraft());
	if (checkConfig(config, "enderstorage-mod")) Integration.addModule(new ModuleEnderStorage());
	if (checkConfig(config, "forestry-mod")) Integration.addModule(new ModuleForestry());
	if (checkConfig(config, "mystcraft-mod")) {
		if (sameOrNewerVersion(Mods.MYSTCRAFT, "0.11.1.00")) {
			if (sameOrNewerVersion(Mods.MYSTCRAFT, "0.11.6.02")) {
				FMLInterModComms.sendMessage(Mods.MYSTCRAFT, "API", "openperipheral.integration.mystcraft.v2.MystcraftAccess.init");
				Integration.addModule(new ModuleMystcraftV2());
			} else {
				Log.warn("Unsupported Mystcraft version!");
			}
		} else {
			Log.warn("Using old Mystcraft integration, things may explode");
			Integration.addModule(new ModuleMystcraftV1());
		}
	}
	if (checkConfig(config, "thaumcraft-mod")) Integration.addModule(new ModuleThaumcraft());
	if (checkConfig(config, "tmechworks-mod")) Integration.addModule(new ModuleTMechworks());
	if (checkConfig(config, "thermalexpansion-mod")) Integration.addModule(new ModuleThermalExpansion());
	if (checkConfig(config, "ae2-mod")) Integration.addModule(new ModuleAppEng());

	ConfigProcessing.processAnnotations(MOD_ID, config, Config.class);

	FMLCommonHandler.instance().bus().register(new ConfigChangeListener(MOD_ID, config));

	if (config.hasChanged()) config.save();
}
 
Example #12
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()));
}