/** * 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); } }
@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); }
@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."); } }
/** * 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); } }
@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); } }
@SubscribeEvent public static void onConfigChanged(final ConfigChangedEvent.OnConfigChangedEvent event) { if (event.getModID().equals(ModConstants.MODID)) { ConfigManager.sync(ModConstants.MODID, Config.Type.INSTANCE); } }
/** Compiles a list of config elements */ private static List<IConfigElement> getConfigElements() { List<IConfigElement> list = new ArrayList<IConfigElement>(); //Add categories to config GUI list.add(categoryElement(SoundPhysicsCore.configFile.CATEGORY_GENERAL, "General", "soundphysics.configgui.ctgy.general")); list.add(categoryElement(SoundPhysicsCore.Config.categoryPerformance, "Performance", "soundphysics.configgui.ctgy.performance")); list.add(categoryElement(SoundPhysicsCore.Config.categoryMaterialProperties, "Material Properties", "soundphysics.configgui.ctgy.materialProperties")); list.add(categoryElement(SoundPhysicsCore.Config.categoryMisc, "Misc", "soundphysics.configgui.ctgy.misc")); return list; }
@SubscribeEvent public static void configChanged(ConfigChangedEvent.OnConfigChangedEvent event) { if(event.getModID().equals(Reference.MOD_ID)) { ConfigManager.sync(Reference.MOD_ID, Config.Type.INSTANCE); } }
/** * 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); } }
@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); } }
@SubscribeEvent public static void configChanged(ConfigChangedEvent.OnConfigChangedEvent event) { if (event.getModID().equals(MODID)) { ConfigManager.load(MODID, Config.Type.INSTANCE); } }
public static void sync() { ConfigManager.sync(Names.MOD_ID, Config.Type.INSTANCE); }
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); }
@SubscribeEvent public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { if (event.getModID().equals(Main.MODID_LOWER)) { ConfigManager.load(Main.MODID_LOWER, Config.Type.INSTANCE); } }
@SubscribeEvent public static void onConfigChanged(ConfigChangedEvent event) { if (event.getModID().equals(Bonfires.modid)) { ConfigManager.sync(Bonfires.modid, Config.Type.INSTANCE); } }
@Override public void onGuiClosed () { super.onGuiClosed(); ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE); }
public static void toggleShowGUI () { client.hud.AlwaysShowGUI += 1; if (client.hud.AlwaysShowGUI > 2) client.hud.AlwaysShowGUI = 0; ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE); }
@SubscribeEvent public static void onConfigChanged(ConfigChangedEvent event) { if (event.getModID().equals(Reference.MODID)) { ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE); } }
@SubscribeEvent public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { if (event.getModID().equals(EnderCompassMod.ID)) ConfigManager.sync(EnderCompassMod.ID, Config.Type.INSTANCE); }
@SubscribeEvent public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { if (event.getModID().equals(Magistics.ID)) { ConfigManager.load(Magistics.ID, Config.Type.INSTANCE); } }
@SubscribeEvent public void onConfigurationChangedEvent(final ConfigChangedEvent.OnConfigChangedEvent event) { if (event.getModID().equalsIgnoreCase(Reference.MODID)) { ConfigManager.sync(Reference.MODID, Config.Type.INSTANCE); } }