Add config file for extra utils recipes.

This commit is contained in:
James McKay committed 2015-12-16 00:33:22 +11:00
1 parent 98ba9c540b
commit 9a4cfa1cfc
2 files changed
+37 -1

No files matched your search

@@ -24,6 +24,7 @@ import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.simple.SimpleLogger;
import org.apache.logging.log4j.util.PropertiesUtil;
import portablejim.bbw.core.BlockEvents;
import portablejim.bbw.core.ConfigValues;
import portablejim.bbw.core.OopsCommand;
import portablejim.bbw.core.items.ItemRestrictedWandAdvanced;
import portablejim.bbw.core.items.ItemRestrictedWandBasic;
@@ -53,6 +54,8 @@ public class BetterBuildersWandsMod {
@SidedProxy(modId = MODID, clientSide = "portablejim.bbw.proxy.ClientProxy", serverSide = "portablejim.bbw.proxy.ServerProxy")
public static IProxy proxy;
public ConfigValues configValues;
public static Logger logger = new SimpleLogger("BetterBuildersWand", Level.ALL, true, false, true, false, "YYYY-MM-DD", null, PropertiesUtil.getProperties(), null);
public static ItemRestrictedWandBasic itemStoneWand;
@@ -66,6 +69,9 @@ public class BetterBuildersWandsMod {
public void preInit(FMLPreInitializationEvent event) {
logger = event.getModLog();
configValues = new ConfigValues(event.getSuggestedConfigurationFile());
configValues.loadConfigFile();
networkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel("bbwands");
networkWrapper.registerMessage(PacketWandActivate.Handler.class, PacketWandActivate.class, 0, Side.SERVER);
@@ -93,7 +99,8 @@ public class BetterBuildersWandsMod {
GameRegistry.addRecipe(new ShapedOreRecipe(BetterBuildersWandsMod.itemIronWand, " H", " S ", "S ", 'S', "stickWood", 'H', "ingotIron"));
GameRegistry.addRecipe(new ShapedOreRecipe(BetterBuildersWandsMod.itemDiamondWand, " H", " S ", "S ", 'S', "stickWood", 'H', "gemDiamond"));
if(Loader.isModLoaded("ExtraUtilities")) {
boolean EXTRA_UTILS_RECIPES = !configValues.NO_EXTRA_UTILS_RECIPES;
if(Loader.isModLoaded("ExtraUtilities") && EXTRA_UTILS_RECIPES) {
Item buildersWand = GameRegistry.findItem("ExtraUtilities", "builderswand");
Item creativebuildersWand = GameRegistry.findItem("ExtraUtilities", "creativebuilderswand");
GameRegistry.addRecipe(new ShapedOreRecipe(newWand(4), " H", " S ", "S ", 'S', "stickWood", 'H', buildersWand));
@@ -0,0 +1,29 @@
package portablejim.bbw.core;
import net.minecraftforge.common.config.Configuration;
import java.io.File;
/**
* Created by james on 16/12/15.
*/
public class ConfigValues {
private Configuration configFile;
public static final String CONFIG_WHYNOT = "why_not";
public boolean NO_EXTRA_UTILS_RECIPES;
public static final boolean NO_EXTRA_UTILS_RECIPES_DEFAULT = false;
public static final String NO_EXTRA_UTILS_RECIPES_NAME = "straymav_ultimate_wand";
public static final String NO_EXTRA_UTILS_RECIPES_DESCRIPTION = "For those that don't like Extra Utils progression.";
public ConfigValues(File file) {
configFile = new Configuration(file);
}
public void loadConfigFile() {
NO_EXTRA_UTILS_RECIPES = configFile.getBoolean(NO_EXTRA_UTILS_RECIPES_NAME, CONFIG_WHYNOT, NO_EXTRA_UTILS_RECIPES_DEFAULT, NO_EXTRA_UTILS_RECIPES_DESCRIPTION);
configFile.save();
}
}