当前位置: 首页>>代码示例>>Java>>正文


Java ConfigManager.sync方法代码示例

本文整理汇总了Java中net.minecraftforge.common.config.ConfigManager.sync方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigManager.sync方法的具体用法?Java ConfigManager.sync怎么用?Java ConfigManager.sync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.common.config.ConfigManager的用法示例。


在下文中一共展示了ConfigManager.sync方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onConfigChanged

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
/**
 * Inject the new values and save to the config file when the config has been changed from the GUI.
 *
 * @param event The event
 */
@SubscribeEvent
public static void onConfigChanged(final ConfigChangedEvent.OnConfigChangedEvent event) {
	if (event.getModID().equals(Strings.MODID)) {

		// sync GUI to settings..
		ConfigManager.sync(Strings.MODID, Config.Type.INSTANCE);

		// this also syncs when done
		UniversalRemoteConfiguration.validateConfig();

		int newCapacity = UniversalRemoteConfiguration.fuel.energy.energyCapacity;

		// gotta set it to zero behind the scenes if energy isn't enabled
		if (!UniversalRemoteConfiguration.fuel.fuelType.equals(UniversalRemoteConfiguration.FuelType.Energy.toString()))
		{
			newCapacity = 0;
		}

		// well crap gotta update the registered item now
		ItemRegistry.Items().UniveralRemote.UpdateEnergySettings(
				newCapacity,
				UniversalRemoteConfiguration.fuel.energy.energyReceiveRate,
				0);
	}
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:31,代码来源:UniversalRemoteConfiguration.java

示例2: keyTyped

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
@Override
protected void keyTyped (char typedChar, int keyCode) throws IOException {
    this.r.textboxKeyTyped(typedChar, keyCode);
    this.g.textboxKeyTyped(typedChar, keyCode);
    this.b.textboxKeyTyped(typedChar, keyCode);
    
    this.a.textboxKeyTyped(typedChar, keyCode);
    
    try {
        int[] colour = { Integer.parseInt(this.r.getText()), Integer.parseInt(this.g.getText()), Integer.parseInt(this.b.getText()) };
        MainConfig.client.hud.interfaceColour = colour;
        int alpha = Integer.parseInt(this.a.getText());
        MainConfig.client.hud.guiAlpha = alpha;
        ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE);
    } catch (NumberFormatException e) {

    }
    super.keyTyped(typedChar, keyCode);
}
 
开发者ID:Wehavecookies56,项目名称:Kingdom-Keys-Re-Coded,代码行数:20,代码来源:GuiMenu_Config.java

示例3: onConfigChanged

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
{
    if (event.getModID().equals(Names.MOD_ID)) {
        ConfigManager.sync(Names.MOD_ID, Config.Type.INSTANCE);
        PneumaticCraftRepressurized.logger.info("Configuration has been saved.");
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:ConfigHandler.java

示例4: onConfigChanged

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
/**
 * Inject the new values and save to the config file when the config has
 * been changed from the GUI.
 *
 * @param event
 *            The event
 */
@SubscribeEvent
public static void onConfigChanged(final ConfigChangedEvent.OnConfigChangedEvent event) {
    if (event.getModID().equals(HardVox.MODID)) {
        if (!validateConfig()) {
            event.setResult(Result.DENY);
            return;
        }
        ConfigManager.sync(HardVox.MODID, Config.Type.INSTANCE);
    }
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:18,代码来源:HardVoxConfig.java

示例5: onConfigChange

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
@SubscribeEvent
public static void onConfigChange(ConfigChangedEvent.OnConfigChangedEvent event) {
    if (event.getModID().equals(FirstAid.MODID)) {
        ConfigManager.sync(FirstAid.MODID, Config.Type.INSTANCE);
        event.setResult(Event.Result.ALLOW);
    }
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:8,代码来源:EventHandler.java

示例6: onConfigChanged

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
@SubscribeEvent
public static void onConfigChanged(final ConfigChangedEvent.OnConfigChangedEvent event)
{
	if (event.getModID().equals(ModConstants.MODID)) {
		ConfigManager.sync(ModConstants.MODID, Config.Type.INSTANCE);
	}
}
 
开发者ID:Lemonszz,项目名称:Anima-Mundi,代码行数:8,代码来源:AnimaConfig.java

示例7: configChanged

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
@SubscribeEvent
public static void configChanged(ConfigChangedEvent.OnConfigChangedEvent event)
{
    if(event.getModID().equals(Reference.MOD_ID))
    {
        ConfigManager.sync(Reference.MOD_ID, Config.Type.INSTANCE);
    }
}
 
开发者ID:adudewithapc,项目名称:Teleporting-XP,代码行数:9,代码来源:ModConfig.java

示例8: onConfigChanged

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
/**
 * Inject the new values and save to the config file when the config has been changed from the GUI.
 *
 * @param event The event
 */
@SubscribeEvent
public static void onConfigChanged(final ConfigChangedEvent.OnConfigChangedEvent event) {
    if (event.getModID().equals(EssentialFeatures.MODID)) {
        ConfigManager.sync(EssentialFeatures.MODID, Config.Type.INSTANCE);
    }
}
 
开发者ID:williambl,项目名称:EssentialFeatures,代码行数:12,代码来源:ModConfig.java

示例9: onConfigChanged

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event)
{
    if (event.getModID().equals(TorchMasterMod.MODID))
    {
        ConfigManager.sync(TorchMasterMod.MODID, Config.Type.INSTANCE);
        TorchRegistry.getMegaTorchRegistry().setTorchRange(MegaTorchRange);
        TorchRegistry.getDreadLampRegistry().setTorchRange(DreadLampRange);
    }
}
 
开发者ID:Xalcon,项目名称:TorchMaster,代码行数:11,代码来源:TorchmasterConfig.java

示例10: onConfigChanged

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) 
{
    if (event.getModID().equals(HardScience.MODID))
    {
        ConfigManager.sync(HardScience.MODID, Type.INSTANCE);
        Configurator.recalcDerived();
    }
}
 
开发者ID:grondag,项目名称:Hard-Science,代码行数:10,代码来源:CommonEventHandler.java

示例11: sync

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
public static void sync() {
    ConfigManager.sync(Names.MOD_ID, Config.Type.INSTANCE);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:4,代码来源:ConfigHandler.java

示例12: validateConfig

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
public static void validateConfig()
{

	// make sure fuel type is valid
	boolean isValueFuelType = false;

	for (FuelType f: FuelType.values())
	{
		if (UniversalRemoteConfiguration.fuel.fuelType.equals(f.toString()))
		{
			isValueFuelType = true;
			break;
		}
	}

	if (!isValueFuelType)
	{
		Util.logger.error("Invalid fuel type of '{}' found in config. Reverting to default value.", UniversalRemoteConfiguration.fuel.fuelType);

		// find the default
		UniversalRemoteConfiguration.fuel.fuelType = new Fuel().fuelType;
	}

	// no negative values!

	if (UniversalRemoteConfiguration.fuel.energy.energyCapacity < 0)
		UniversalRemoteConfiguration.fuel.energy.energyCapacity = 0;

	if (UniversalRemoteConfiguration.fuel.energy.energyReceiveRate < 0)
		UniversalRemoteConfiguration.fuel.energy.energyReceiveRate = 0;

	if (UniversalRemoteConfiguration.fuel.energy.energyCostPerBlock < 0)
		UniversalRemoteConfiguration.fuel.energy.energyCostPerBlock = 0;

	if (UniversalRemoteConfiguration.fuel.energy.energyCostMax < 0)
		UniversalRemoteConfiguration.fuel.energy.energyCostMax = 0;

	if (UniversalRemoteConfiguration.fuel.energy.energyCostBindBlock < 0)
		UniversalRemoteConfiguration.fuel.energy.energyCostBindBlock = 0;

	// better re-sync
	ConfigManager.sync(Strings.MODID, Config.Type.INSTANCE);
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:44,代码来源:UniversalRemoteConfiguration.java

示例13: onConfigChanged

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent event) {
    if (event.getModID().equals(Bonfires.modid)) {
        ConfigManager.sync(Bonfires.modid, Config.Type.INSTANCE);
    }
}
 
开发者ID:Wehavecookies56,项目名称:Bonfires,代码行数:7,代码来源:BonfiresConfig.java

示例14: onGuiClosed

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
@Override
public void onGuiClosed () {
    super.onGuiClosed();
    ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE);
}
 
开发者ID:Wehavecookies56,项目名称:Kingdom-Keys-Re-Coded,代码行数:6,代码来源:GuiMenu_Config.java

示例15: toggleShowGUI

import net.minecraftforge.common.config.ConfigManager; //导入方法依赖的package包/类
public static void toggleShowGUI () {
    client.hud.AlwaysShowGUI += 1;
    if (client.hud.AlwaysShowGUI > 2)
        client.hud.AlwaysShowGUI = 0;
    ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE);
}
 
开发者ID:Wehavecookies56,项目名称:Kingdom-Keys-Re-Coded,代码行数:7,代码来源:MainConfig.java


注:本文中的net.minecraftforge.common.config.ConfigManager.sync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。