Java Code Examples for net.minecraftforge.common.config.Configuration#save()

The following examples show how to use net.minecraftforge.common.config.Configuration#save() . 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: ConfigManager.java    From GardenCollection with MIT License 6 votes vote down vote up
public ConfigManager (File file) {
    config = new Configuration(file);

    Property propEnableCompostBonemeal = config.get(Configuration.CATEGORY_GENERAL, "enableCompostBonemeal", true);
    propEnableCompostBonemeal.comment = "Allows compost trigger plant growth like bonemeal.";
    enableCompostBonemeal = propEnableCompostBonemeal.getBoolean();

    Property propCompostBonemealStrength = config.get(Configuration.CATEGORY_GENERAL, "compostBonemealStrength", 0.5);
    propCompostBonemealStrength.comment = "The probability that compost will succeed when used as bonemeal relative to bonemeal.";
    compostBonemealStrength = propCompostBonemealStrength.getDouble();

    Property propEnableTilledSoilGrowthBonus = config.get(Configuration.CATEGORY_GENERAL, "enableTilledSoilGrowthBonus", true).setRequiresMcRestart(true);
    propEnableTilledSoilGrowthBonus.comment = "Allows tilled garden soil to advance crop growth more quickly.  Enables random ticks.";
    enableTilledSoilGrowthBonus = propEnableTilledSoilGrowthBonus.getBoolean();

    config.save();
}
 
Example 2
Source File: ClientProxy.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@Override
public void saveUILayout(Configuration configuration) {
	final String CLIENT = "Client";
	configuration.get(CLIENT, "suitPanelX", 1).set(RocketEventHandler.suitPanel.getRawX());
	configuration.get(CLIENT, "suitPanelY", 1).set(RocketEventHandler.suitPanel.getRawY());
	configuration.get(CLIENT, "suitPanelModeX", 1).set(RocketEventHandler.suitPanel.getSizeModeX());
	configuration.get(CLIENT, "suitPanelModeY", 1).set(RocketEventHandler.suitPanel.getSizeModeY());
	
	configuration.get(CLIENT, "oxygenBarX", 1).set(RocketEventHandler.oxygenBar.getRawX());
	configuration.get(CLIENT, "oxygenBarY", 1).set(RocketEventHandler.oxygenBar.getRawY());
	configuration.get(CLIENT, "oxygenBarModeX", 1).set(RocketEventHandler.oxygenBar.getSizeModeX());
	configuration.get(CLIENT, "oxygenBarModeY", 1).set(RocketEventHandler.oxygenBar.getSizeModeY());
	
	configuration.get(CLIENT, "hydrogenBarX", 1).set(RocketEventHandler.hydrogenBar.getRawX());
	configuration.get(CLIENT, "hydrogenBarY", 1).set(RocketEventHandler.hydrogenBar.getRawY());
	configuration.get(CLIENT, "hydrogenBarModeX", 1).set(RocketEventHandler.hydrogenBar.getSizeModeX());
	configuration.get(CLIENT, "hydrogenBarModeY", 1).set(RocketEventHandler.hydrogenBar.getSizeModeY());
	
	configuration.get(CLIENT, "atmBarX", 1).set(RocketEventHandler.atmBar.getRawX());
	configuration.get(CLIENT, "atmBarY", 1).set(RocketEventHandler.atmBar.getRawY());
	configuration.get(CLIENT, "atmBarModeX", 1).set(RocketEventHandler.atmBar.getSizeModeX());
	configuration.get(CLIENT, "atmBarModeY", 1).set(RocketEventHandler.atmBar.getSizeModeY());
	configuration.save();
}
 
Example 3
Source File: MainHelmetHandler.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void saveToConfig(){
    Configuration config = Config.config;
    config.load();
    if(powerStat != null) {
        config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Power_Stat", "stat X", -1).set(powerStat.getBaseX());
        config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Power_Stat", "stat Y", 2).set(powerStat.getBaseY());
        config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Power_Stat", "stat leftsided", true).set(powerStat.isLeftSided());
        powerStatX = powerStat.getBaseX();
        powerStatY = powerStat.getBaseY();
        powerStatLeftSided = powerStat.isLeftSided();
    }
    if(testMessageStat != null) {
        config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Message_Stat", "stat X", 2).set(testMessageStat.getBaseX());
        config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Message_Stat", "stat Y", 2).set(testMessageStat.getBaseY());
        config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Message_Stat", "stat leftsided", false).set(testMessageStat.isLeftSided());
        messagesStatX = testMessageStat.getBaseX();
        messagesStatY = testMessageStat.getBaseY();
        messagesStatLeftSided = testMessageStat.isLeftSided();
        messagesStatX = testMessageStat.getBaseX();
        messagesStatY = testMessageStat.getBaseY();
        messagesStatLeftSided = testMessageStat.isLeftSided();
    }
    config.save();
}
 
Example 4
Source File: ForgeMetrics.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
public ForgeMetrics(final String modName, final String modVersion) throws IOException {
    if (modName == null || modVersion == null) {
        throw new IllegalArgumentException("modName and modVersion cannot be null");
    }

    this.modName = modName;
    this.modVersion = modVersion;

    // load the config
    configurationFile = getConfigFile();
    configuration = new Configuration(configurationFile);

    // Get values, and add some defaults, if needed
    configuration.get(Configuration.CATEGORY_GENERAL, "opt-out", false, "Set to true to disable all reporting");
    guid = configuration.get(Configuration.CATEGORY_GENERAL, "guid", UUID.randomUUID().toString(), "Server unique ID").getString();
    debug = configuration.get(Configuration.CATEGORY_GENERAL, "debug", false, "Set to true for verbose debug").getBoolean(false);
    configuration.save();
}
 
Example 5
Source File: Config.java    From Logistics-Pipes-2 with MIT License 6 votes vote down vote up
/**
 * Read the config file ordered by Category
 * @throws Exception to Log when sth goes wrong
 */
public static void readConfig(){
	Configuration cfg = CommonProxy.config;
	
	try{
		cfg.load();
		initGeneral(cfg);
		initNetwork(cfg);
		initWorld(cfg);
	}
	catch(Exception e){
		LogisticsPipes2.logger.log(Level.ERROR, "There was a Problem reading the Config File!");
	}
	finally{
		if(cfg.hasChanged()){
			cfg.save();
		}
	}
}
 
Example 6
Source File: ForgeMetrics.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
public ForgeMetrics(final String modName, final String modVersion) throws IOException {
    if (modName == null || modVersion == null) {
        throw new IllegalArgumentException("modName and modVersion cannot be null");
    }

    this.modName = modName;
    this.modVersion = modVersion;

    // load the config
    configurationFile = getConfigFile();
    configuration = new Configuration(configurationFile);

    // Get values, and add some defaults, if needed
    configuration.get(Configuration.CATEGORY_GENERAL, "opt-out", false, "Set to true to disable all reporting");
    guid = configuration.get(Configuration.CATEGORY_GENERAL, "guid", UUID.randomUUID().toString(), "Server unique ID").getString();
    debug = configuration.get(Configuration.CATEGORY_GENERAL, "debug", false, "Set to true for verbose debug").getBoolean(false);
    configuration.save();
}
 
Example 7
Source File: IGWSupportNotifier.java    From IGW-mod with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Needs to be instantiated somewhere in your mod's loading stage.
 */
public IGWSupportNotifier(){
    if(FMLCommonHandler.instance().getSide() == Side.CLIENT && !Loader.isModLoaded("IGWMod")) {
        File dir = new File(".", "config");
        Configuration config = new Configuration(new File(dir, "IGWMod.cfg"));
        config.load();

        if(config.get(Configuration.CATEGORY_GENERAL, "enable_missing_notification", true, "When enabled, this will notify players when IGW-Mod is not installed even though mods add support.").getBoolean()) {
            ModContainer mc = Loader.instance().activeModContainer();
            String modid = mc.getModId();
            List<ModContainer> loadedMods = Loader.instance().getActiveModList();
            for(ModContainer container : loadedMods) {
                if(container.getModId().equals(modid)) {
                    supportingMod = container.getName();
                    MinecraftForge.EVENT_BUS.register(this);
                    ClientCommandHandler.instance.registerCommand(new CommandDownloadIGW());
                    break;
                }
            }
        }
        config.save();
    }
}
 
Example 8
Source File: ForgeMetrics.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
public ForgeMetrics(final String modName, final String modVersion) throws IOException {
    if (modName == null || modVersion == null) {
        throw new IllegalArgumentException("modName and modVersion cannot be null");
    }

    this.modName = modName;
    this.modVersion = modVersion;

    // load the config
    configurationFile = getConfigFile();
    configuration = new Configuration(configurationFile);

    // Get values, and add some defaults, if needed
    configuration.get(Configuration.CATEGORY_GENERAL, "opt-out", false, "Set to true to disable all reporting");
    guid = configuration.get(Configuration.CATEGORY_GENERAL, "guid", UUID.randomUUID().toString(), "Server unique ID").getString();
    debug = configuration.get(Configuration.CATEGORY_GENERAL, "debug", false, "Set to true for verbose debug").getBoolean(false);
    configuration.save();
}
 
Example 9
Source File: ForgeMetrics.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
public ForgeMetrics(final String modName, final String modVersion) throws IOException {
    if (modName == null || modVersion == null) {
        throw new IllegalArgumentException("modName and modVersion cannot be null");
    }

    this.modName = modName;
    this.modVersion = modVersion;

    // load the config
    configurationFile = getConfigFile();
    configuration = new Configuration(configurationFile);

    // Get values, and add some defaults, if needed
    configuration.get(Configuration.CATEGORY_GENERAL, "opt-out", false, "Set to true to disable all reporting");
    guid = configuration.get(Configuration.CATEGORY_GENERAL, "guid", UUID.randomUUID().toString(), "Server unique ID").getString();
    debug = configuration.get(Configuration.CATEGORY_GENERAL, "debug", false, "Set to true for verbose debug").getBoolean(false);
    configuration.save();
}
 
Example 10
Source File: ForgeMetrics.java    From FastAsyncWorldedit with GNU General Public License v3.0 6 votes vote down vote up
public ForgeMetrics(final String modName, final String modVersion) throws IOException {
    if (modName == null || modVersion == null) {
        throw new IllegalArgumentException("modName and modVersion cannot be null");
    }

    this.modName = modName;
    this.modVersion = modVersion;

    // load the config
    configurationFile = getConfigFile();
    configuration = new Configuration(configurationFile);

    // Get values, and add some defaults, if needed
    configuration.get(Configuration.CATEGORY_GENERAL, "opt-out", false, "Set to true to disable all reporting");
    guid = configuration.get(Configuration.CATEGORY_GENERAL, "guid", UUID.randomUUID().toString(), "Server unique ID").getString();
    debug = configuration.get(Configuration.CATEGORY_GENERAL, "debug", false, "Set to true for verbose debug").getBoolean(false);
    configuration.save();
}
 
Example 11
Source File: ConfigManager.java    From GardenCollection with MIT License 5 votes vote down vote up
public ConfigManager (File file) {
    config = new Configuration(file);

    Property propStrangePlantDrops = config.get(Configuration.CATEGORY_GENERAL, "strangePlantDrops", new String[0]);
    propStrangePlantDrops.comment = "A list of zero or more item IDs.  Breaking the plant will drop an item picked at random from the list.  Ex: minecraft:coal:1";

    Property propStrangePlantDropChance = config.get(Configuration.CATEGORY_GENERAL, "strangePlantDropChance", 1.0);
    propStrangePlantDropChance.comment = "The probability from 0.0 - 1.0 that breaking a strange plant will drop its contents.";
    strangePlantDropChance = propStrangePlantDropChance.getDouble();

    Property propStrangePlantDropMin = config.get(Configuration.CATEGORY_GENERAL, "strangePlantDropMin", 1);
    propStrangePlantDropMin.comment = "The minimum number of items dropped when breaking a strange plant.";
    strangePlantDropMin = propStrangePlantDropMin.getInt();

    Property propStrangePlantDropMax = config.get(Configuration.CATEGORY_GENERAL, "strangePlantDropMax", 1);
    propStrangePlantDropMax.comment = "The maximum number of items dropped when breaking a strange plant.";
    strangePlantDropMax = propStrangePlantDropMax.getInt();

    Property propCompostGrowsOrnamentalTrees = config.get(Configuration.CATEGORY_GENERAL, "compostGrowsOrnamentalTrees", true);
    propCompostGrowsOrnamentalTrees.comment = "Using compost on saplings will grow ornamental (miniature) trees instead of normal trees.";
    compostGrowsOrnamentalTrees = propCompostGrowsOrnamentalTrees.getBoolean();

    Property propGenerateCandelilla = config.get(Configuration.CATEGORY_GENERAL, "generateCandelilla", true);
    propGenerateCandelilla.comment = "Generates clusters of candelilla shrub in warm, sandy biomes.";
    generateCandelilla = propGenerateCandelilla.getBoolean();

    config.save();
}
 
Example 12
Source File: CoordTrackUpgradeHandler.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void saveToConfig(){
    Configuration config = Config.config;
    config.load();
    config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Coordinate_Tracker", "Path Enabled", true).set(pathEnabled);
    config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Coordinate_Tracker", "Wire Path", true).set(wirePath);
    config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Coordinate_Tracker", "X-Ray", true).set(xRayEnabled);
    config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Coordinate_Tracker", "Path Update Rate", true).set(pathUpdateSetting);
    config.save();
}
 
Example 13
Source File: Config.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
public static void doNormalConfig(File file)
{
	Configuration config = new Configuration(file);
	
	config.load();
	
	enableBarrels = config.get("Mechanics", "barrels", true).getBoolean();
	enableCrucible = config.get("Mechanics", "crucible", true).getBoolean();
	shouldBarrelsFillWithRain = config.get("Mechanics", "barrelsFillWithRain", true).getBoolean();
	fakePlayersCanSieve = config.get("Mechanics", "fakePlayersCanSieve", false).getBoolean();
	
	compostingTicks = config.get("Composting", "ticksToFormDirt", 600).getInt();
	
	infestedLeavesTicks = config.get("Infested Leaves","ticksToTransform",600).getInt();
       leavesUpdateFrequency = config.get("Infested Leaves", "leavesUpdateFrequency", 40).getInt();
       leavesSpreadChance = config.get("Infested Leaves", "leavesSpreadChance", 0.0015).getDouble();
       doLeavesUpdateClient = config.get("Infested Leaves", "doLeavesUpdateClient", true).getBoolean();
	
       enableBarrelTransformLighting = config.get("Misc", "enableBarrelTransformLighting", true).getBoolean();
       
	stringChance = config.get("Crooking", "stringChance", 1).getDouble();
	stringFortuneChance = config.get("Crooking", "stringFortuneChance", 1).getDouble();
	
	sieveSimilarRadius = config.get("Sieving", "sieveSimilarRadius", 2).getInt();
	
	doEnderIOCompat = config.get("Compatibilitiy", "EnderIO", true).getBoolean();
	doTICCompat = config.get("Compatibilitiy", "TinkersConstruct", true).getBoolean();
	doTOPCompat = config.get("Compatibilitiy", "TheOneProbe", true).getBoolean();
	shouldOreDictOreChunks = config.get("Compatibilitiy", "OreDictOreChunks", true).getBoolean();
	shouldOreDictOreDusts = config.get("Compatibilitiy", "OreDictOreDusts", true).getBoolean();
	
	setFireToMacroUsers = config.get("Sieving", "setFireToMacroUsers", false).getBoolean();
	sievesAutoOutput = config.get("Sieving", "sievesAutoOutput", false).getBoolean();
	
	numberOfTimesToTestVanillaDrops = config.get("Crooking", "numberOfVanillaDropRuns", 3).getInt();
	
	if (config.hasChanged())
		config.save();
}
 
Example 14
Source File: CyberwareConfig.java    From Cyberware with MIT License 5 votes vote down vote up
public static void preInit(FMLPreInitializationEvent event)
{
	configDirectory = event.getModConfigurationDirectory();
	config = new Configuration(new File(event.getModConfigurationDirectory(), Cyberware.MODID + ".cfg"));
	startingItems = defaultStartingItems = new String[EnumSlot.values().length][0];
	startingStacks = new ItemStack[EnumSlot.values().length][LibConstants.WARE_PER_SLOT];
	
	int j = 0;
	for (int i = 0; i < EnumSlot.values().length; i++)
	{
		if (EnumSlot.values()[i].hasEssential())
		{
			if (EnumSlot.values()[i].isSided())
			{
				defaultStartingItems[i] = new String[] { "cyberware:bodyPart 1 " + j, "cyberware:bodyPart 1 " + (j + 1)  };
				j += 2;
			}
			else
			{
				defaultStartingItems[i] = new String[] { "cyberware:bodyPart 1 " + j };
				j++;
			}
		}
		else
		{
			defaultStartingItems[i] = new String[0];
		}
	}
	loadConfig();
	
	config.load();
	for (int index = 0; index < EnumSlot.values().length; index++)
	{
		EnumSlot slot = EnumSlot.values()[index];
		startingItems[index] = config.getStringList("Default augments for " + slot.getName() + " slot",
				"Defaults", defaultStartingItems[index], "Use format 'id amount metadata'");
	}
	config.save();
	
}
 
Example 15
Source File: YouTubeConfiguration.java    From youtube-chat-for-minecraft with Apache License 2.0 5 votes vote down vote up
private YouTubeConfiguration(File path) {
  config = new Configuration(path);
  config.load();
  addGeneralConfig();
  if (config.hasChanged()) {
    config.save();
  }
}
 
Example 16
Source File: SearchUpgradeHandler.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void saveToConfig(){
    Configuration config = Config.config;
    config.load();
    config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Item_Search", "stat X", -1).set(searchInfo.getBaseX());
    config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Item_Search", "stat Y", 17).set(searchInfo.getBaseY());
    config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Item_Search", "stat leftsided", true).set(searchInfo.isLeftSided());
    config.save();
    statX = searchInfo.getBaseX();
    statY = searchInfo.getBaseY();
    statLeftSided = searchInfo.isLeftSided();
}
 
Example 17
Source File: ConfigStorage.java    From OpenModsLib with MIT License 4 votes vote down vote up
public void saveAll(String modId) {
	for (Configuration config : configs.get(modId))
		if (config.hasChanged()) config.save();
}
 
Example 18
Source File: TraverseConfig.java    From Traverse-Legacy-1-12-2 with MIT License 4 votes vote down vote up
private TraverseConfig() {
	config = new Configuration(mainConfig);
	config.load();

	useVanillaWood = config.get(Configuration.CATEGORY_GENERAL, "useVanillaWood", useVanillaWood, "Use vanilla logs for Traverse trees (might not look as nice)").getBoolean();
	registerBiomesRegardless = config.get(Configuration.CATEGORY_GENERAL, "registerBiomesRegardless", registerBiomesRegardless, "All biomes will always be registered, ignoring the instance traverse_world_data (WARNING: This will cause ugly world generation borders at the edge of what has previously been generated and what is new!!)").getBoolean();
	disableCustomSkies = config.get(Configuration.CATEGORY_GENERAL, "disableCustomSkies", disableCustomSkies, "When true, Traverse will only use the default sky colour.").getBoolean();
	vanillaCanyonBlocks = config.get(Configuration.CATEGORY_GENERAL, "vanillaCanyonBlocks", vanillaCanyonBlocks, "Use vanilla Red Sandstone instead of Red Rock in the Canyon biome.").getBoolean();
	findBiomeCommandTimeout = config.get(Configuration.CATEGORY_GENERAL, "findBiomeCommandTimeout", findBiomeCommandTimeout, "How long, in ms, the /findbiome command will search for biomes before timing out, normally 20000ms").getInt();
	disallowVillages = config.get(Configuration.CATEGORY_GENERAL, "disallowVillages", disallowVillages, "With this enabled, villages will not spawn in Traverse biomes").getBoolean();
	disallowBoulders = config.get(Configuration.CATEGORY_GENERAL, "disallowBoulders", disallowBoulders, "With this enabled, cobblestone boulder formations will not spawn in Traverse biomes").getBoolean();

	disableAutumnalWoods = config.get(CATEGORY_BIOMES, "disableAutumnalWoods", disableAutumnalWoods, "Force disable the Autumnal Woods biome").getBoolean();
	disableWoodlands = config.get(CATEGORY_BIOMES, "disableWoodlands", disableWoodlands, "Force disable the Woodlands biome").getBoolean();
	disableMiniJungle = config.get(CATEGORY_BIOMES, "disableMiniJungle", disableMiniJungle, "Force disable the Mini Jungle biome").getBoolean();
	disableMeadow = config.get(CATEGORY_BIOMES, "disableMeadow", disableMeadow, "Force disable the Meadow biome").getBoolean();
	disableLushSwamp = config.get(CATEGORY_BIOMES, "disableLushSwamp", disableLushSwamp, "Force disable the Lush Swamp biome").getBoolean();
	disableRedDesert = config.get(CATEGORY_BIOMES, "disableRedDesert", disableRedDesert, "Force disable the Red Desert biome").getBoolean();
	disableTemperateRainforest = config.get(CATEGORY_BIOMES, "disableTemperateRainforest", disableTemperateRainforest, "Force disable the Temperate Rainforest biome").getBoolean();
	disableBadlands = config.get(CATEGORY_BIOMES, "disableBadlands", disableBadlands, "Force disable the Badlands biome").getBoolean();
	disableMountainousDesert = config.get(CATEGORY_BIOMES, "disableMountainousDesert", disableMountainousDesert, "Force disable the Mountainous Desert biome").getBoolean();
	disableRockyPlateau = config.get(CATEGORY_BIOMES, "disableRockyPlateau", disableRockyPlateau, "Force disable the Rocky Plateau biome").getBoolean();
	disableForestedHills = config.get(CATEGORY_BIOMES, "disableForestedHills", disableForestedHills, "Force disable the Forested Hills biome").getBoolean();
	disableBirchForestedHills = config.get(CATEGORY_BIOMES, "disableBirchForestedHills", disableBirchForestedHills, "Force disable the Birch Forested Hills biome").getBoolean();
	disableAutumnalWoodedHills = config.get(CATEGORY_BIOMES, "disableAutumnalWoodedHills", disableAutumnalWoodedHills, "Force disable the Autumnal Wooded Hills biome").getBoolean();
	disableCliffs = config.get(CATEGORY_BIOMES, "disableCliffs", disableCliffs, "Force disable the Cliffs biome").getBoolean();
	disableGlacier = config.get(CATEGORY_BIOMES, "disableGlacier", disableGlacier, "Force disable the Glacier biome").getBoolean();
	disableGlacierSpikes = config.get(CATEGORY_BIOMES, "disableGlacierSpikes", disableGlacierSpikes, "Force disable the Glacier Spikes biome").getBoolean();
	disableSnowyConiferousForest = config.get(CATEGORY_BIOMES, "disableSnowyConiferousForest", disableSnowyConiferousForest, "Force disable the Snowy Coniferous Forest biome").getBoolean();
	disableLushHills = config.get(CATEGORY_BIOMES, "disableLushHills", disableLushHills, "Force disable the Lush Hills biome").getBoolean();
	disableCanyon = config.get(CATEGORY_BIOMES, "disableCanyon", disableCanyon, "Force disable the Canyon biome").getBoolean();
	disableCragCliffs = config.get(CATEGORY_BIOMES, "disableCragCliffs", disableCragCliffs, "Force disable the Crag Cliffs biome").getBoolean();
	disableDesertShrubland = config.get(CATEGORY_BIOMES, "disableDesertShrubland", disableDesertShrubland, "Force disable the Desert Shrubland biome").getBoolean();
	disableThicket = config.get(CATEGORY_BIOMES, "disableThicket", disableThicket, "Force disable the Thicket biome").getBoolean();
	disableAridHighland = config.get(CATEGORY_BIOMES, "disableAridHighland", disableAridHighland, "Force disable the Arid Highland biome").getBoolean();
	disableRockyPlains = config.get(CATEGORY_BIOMES, "disableRockyPlains", disableRockyPlains, "Force disable the Rocky Plains biome").getBoolean();

	enableNewTextures = config.get(Configuration.CATEGORY_CLIENT, "enableNewTextures", enableNewTextures, "Enable the new Traverse textures in the newer minecraft style").getBoolean();

	config.save();
}
 
Example 19
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 20
Source File: OpenMods.java    From OpenModsLib with MIT License 3 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent evt) {
	new TypeVariableHolderHandler().fillAllHolders(evt.getAsmData());

	SyncChannelHolder.ensureLoaded();

	final File configFile = evt.getSuggestedConfigurationFile();
	Configuration config = new Configuration(configFile);
	ConfigProcessing.processAnnotations(MODID, config, LibConfig.class);
	MinecraftForge.EVENT_BUS.register(new ConfigChangeListener(MODID, config));

	if (config.hasChanged()) config.save();

	MinecraftForge.EVENT_BUS.register(DelayedEntityLoadManager.instance);

	MinecraftForge.EVENT_BUS.register(FakePlayerPool.instance);

	MinecraftForge.EVENT_BUS.register(DropCapture.instance);

	MinecraftForge.EVENT_BUS.register(DelayedActionTickHandler.INSTANCE);

	MinecraftForge.EVENT_BUS.register(ConfigStorage.instance);

	collector = new ClassSourceCollector(evt.getAsmData());

	ItemTextureCapability.register();

	final CompoundDataFixer dataFixer = FMLCommonHandler.instance().getDataFixer();

	EntityRegistry.registerModEntity(OpenMods.location("block"), EntityBlock.class, "Block", ENTITY_BLOCK_ID, instance, 64, 1, true);
	EntityBlock.registerFixes(dataFixer, EntityBlock.class);
	proxy.preInit();
}