Java 类net.minecraftforge.common.config.ConfigManager 实例源码

项目:UniversalRemote    文件:UniversalRemoteConfiguration.java   
/**
 * 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);
    }
}
项目:Kingdom-Keys-Re-Coded    文件:GuiMenu_Config.java   
@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);
}
项目:pnc-repressurized    文件:ConfigHandler.java   
@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.");
    }
}
项目:HardVox    文件:HardVoxConfig.java   
/**
 * 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);
    }
}
项目:FirstAid    文件:EventHandler.java   
@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);
    }
}
项目:Anima-Mundi    文件:AnimaConfig.java   
@SubscribeEvent
public static void onConfigChanged(final ConfigChangedEvent.OnConfigChangedEvent event)
{
    if (event.getModID().equals(ModConstants.MODID)) {
        ConfigManager.sync(ModConstants.MODID, Config.Type.INSTANCE);
    }
}
项目:Teleporting-XP    文件:ModConfig.java   
@SubscribeEvent
public static void configChanged(ConfigChangedEvent.OnConfigChangedEvent event)
{
    if(event.getModID().equals(Reference.MOD_ID))
    {
        ConfigManager.sync(Reference.MOD_ID, Config.Type.INSTANCE);
    }
}
项目:EssentialFeatures    文件:ModConfig.java   
/**
 * 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);
    }
}
项目:TorchMaster    文件:TorchmasterConfig.java   
@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);
    }
}
项目:geomastery    文件:Geomastery.java   
@SubscribeEvent
public static void configChanged(ConfigChangedEvent.OnConfigChangedEvent
        event) {

    if (event.getModID().equals(MODID)) {

        ConfigManager.load(MODID, Config.Type.INSTANCE);
    }
}
项目:Hard-Science    文件:CommonEventHandler.java   
@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) 
{
    if (event.getModID().equals(HardScience.MODID))
    {
        ConfigManager.sync(HardScience.MODID, Type.INSTANCE);
        Configurator.recalcDerived();
    }
}
项目:pnc-repressurized    文件:ConfigHandler.java   
public static void sync() {
    ConfigManager.sync(Names.MOD_ID, Config.Type.INSTANCE);
}
项目:UniversalRemote    文件:UniversalRemoteConfiguration.java   
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);
}
项目:LagGoggles    文件:ConfigData.java   
@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
    if (event.getModID().equals(Main.MODID_LOWER)) {
        ConfigManager.load(Main.MODID_LOWER, Config.Type.INSTANCE);
    }
}
项目:Bonfires    文件:BonfiresConfig.java   
@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent event) {
    if (event.getModID().equals(Bonfires.modid)) {
        ConfigManager.sync(Bonfires.modid, Config.Type.INSTANCE);
    }
}
项目:Kingdom-Keys-Re-Coded    文件:GuiMenu_Config.java   
@Override
public void onGuiClosed () {
    super.onGuiClosed();
    ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE);
}
项目:Kingdom-Keys-Re-Coded    文件:MainConfig.java   
public static void toggleShowGUI () {
    client.hud.AlwaysShowGUI += 1;
    if (client.hud.AlwaysShowGUI > 2)
        client.hud.AlwaysShowGUI = 0;
    ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE);
}
项目:Kingdom-Keys-Re-Coded    文件:MainConfig.java   
@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent event) {
    if (event.getModID().equals(Reference.MODID)) {
        ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE);
    }
}
项目:Kingdom-Keys-Re-Coded    文件:BalanceConfig.java   
@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent event) {
    if (event.getModID().equals(Reference.MODID)) {
        ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE);
    }
}
项目:EnderCompass    文件:EnderCompassMod.java   
@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
    if (event.getModID().equals(EnderCompassMod.ID))
        ConfigManager.sync(EnderCompassMod.ID, Config.Type.INSTANCE);
}
项目:magistics    文件:ConfigBase.java   
@SubscribeEvent
public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
    if (event.getModID().equals(Magistics.ID)) {
        ConfigManager.load(Magistics.ID, Config.Type.INSTANCE);
    }
}
项目:LunatriusCore    文件:ConfigurationHandler.java   
@SubscribeEvent
public void onConfigurationChangedEvent(final ConfigChangedEvent.OnConfigChangedEvent event) {
    if (event.getModID().equalsIgnoreCase(Reference.MODID)) {
        ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE);
    }
}