Okay so I am working on a mod, and basically I want to use
GameRegistry.addSmelting(Items.rotten_flesh, new ItemStack(Items.leather), 0.3F);
to make it so that players can smelt rotten flesh into leather. However, I want players to be able to disable this in a .cfg file if they so desire. But I have very little experience with creating config files, virtually no idea how to. I have read multiple tutorials but they are all from different versions and they all say different things. I think there is probably some best way to do this but I just dont know and I cant find a clear tutorial. So here is my entire code:
Main.java:
package com.bored.morefuelsmod;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.common.config.Configuration;
@Mod(modid = Main.MODID, version = Main.VERSION, name=Main.MODNAME)
public class Main {
public static final String MODID = "morefuels";
public static final String VERSION = "1.1.0";
public static final String MODNAME = "More Fuels Mod";
@Instance(value = Main.MODID)
public static Main instance;
@EventHandler
public void preinit(FMLPreInitializationEvent event){
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
boolean disableRFtLrecipe = config.get(config.CATEGORY_GENERAL, "disableRFtLrecipe", false).getBoolean(false);
if(disableRFtLrecipe){
GameRegistry.addSmelting(Items.rotten_flesh, new ItemStack(Items.leather), 0.3F);
}
}
@EventHandler
public void init(FMLInitializationEvent event){
GameRegistry.registerFuelHandler(new Fuels());
}
}
ConfigHandler.java (not sure about this but I heard i should do this seperately.
package com.bored.morefuelsmod;
import java.io.File;
import net.minecraftforge.common.config.Configuration;
public class ConfigHandler {
public static void init(File configFile) {
Configuration config = new Configuration(configFile);
config.load();
boolean disableRFtLrecipe = config.get(config.CATEGORY_GENERAL, "disableRFtLrecipe", false).getBoolean(false);
config.save();
}
}
Please be detailed and try to simplify it, I very much appreciate code examples.