类net.minecraftforge.common.config.ConfigCategory源码实例Demo

下面列出了怎么用net.minecraftforge.common.config.ConfigCategory的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: TickDynamic   文件: ListManager.java
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;
	}
}
 
源代码2 项目: TickDynamic   文件: ListManager.java
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;
	}
}
 
@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);
}
 
源代码4 项目: NEI-Integration   文件: ConfigGui.java
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;
}
 
源代码5 项目: SimplyJetpacks   文件: ConfigGui.java
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;
}
 
源代码6 项目: Electro-Magic-Tools   文件: EMTGuiConfig.java
@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;
}
 
源代码7 项目: LunatriusCore   文件: GuiConfigComplex.java
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;
}
 
源代码8 项目: OpenPeripheral   文件: ConfigGuiFactory.java
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);
}
 
源代码9 项目: TickDynamic   文件: TickDynamicMod.java
public ConfigCategory getWorldConfigCategory(World world) {
	return config.getCategory(getWorldPrefix(world));
}
 
public ConfigCategory getConfigurationCategory()
{
    return _configuration.getCategory(Configuration.CATEGORY_GENERAL);
}
 
@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();
}
 
源代码12 项目: Chisel-2   文件: GuiChiselConfig.java
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()));
}
 
 类方法
 同包方法