ActuallyAdditions/src/main/java/de/ellpeck/actuallyadditions/mod/config/ConfigurationHandler.java
Shadows_of_Fire f2b24c3318 Closes #872
There dad u got ur thingy
also who put these null itemstacks here bad
2017-08-01 22:20:47 -04:00

50 lines
No EOL
1.4 KiB
Java

/*
* This file ("ConfigurationHandler.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.mod.config;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.io.File;
public class ConfigurationHandler{
public static Configuration config;
public ConfigurationHandler(File configFile){
ModUtil.LOGGER.info("Grabbing Configurations...");
MinecraftForge.EVENT_BUS.register(this);
config = new Configuration(configFile);
config.load();
redefineConfigs();
}
public static void redefineConfigs(){
ConfigValues.defineConfigValues(config);
if(config.hasChanged()){
config.save();
}
}
@SubscribeEvent
public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event){
if(event.getModID().equalsIgnoreCase(ModUtil.MOD_ID)){
redefineConfigs();
}
}
}