From 9662faeee73d7299f9016d28b494a09bdb8989d2 Mon Sep 17 00:00:00 2001 From: oitsjustjose Date: Thu, 28 Jan 2016 15:43:24 -0500 Subject: [PATCH] Added feature control --- .../criss_cross/gui/ConfigGUI.java | 1 + .../oitsjustjose/criss_cross/lib/Config.java | 63 ++++++++++++++++++- .../criss_cross/lib/LibBlocks.java | 19 +++--- .../criss_cross/lib/LibItems.java | 31 +++++---- 4 files changed, 94 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/oitsjustjose/criss_cross/gui/ConfigGUI.java b/src/main/java/com/oitsjustjose/criss_cross/gui/ConfigGUI.java index ecb5f13..c539119 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/gui/ConfigGUI.java +++ b/src/main/java/com/oitsjustjose/criss_cross/gui/ConfigGUI.java @@ -29,6 +29,7 @@ public class ConfigGUI extends GuiConfig list.add(new ConfigElement(Config.Electroextractor)); list.add(new ConfigElement(Config.Woodchipper)); list.add(new ConfigElement(Config.OtherMachines)); + list.add(new ConfigElement(Config.FeatureControl)); return list; } diff --git a/src/main/java/com/oitsjustjose/criss_cross/lib/Config.java b/src/main/java/com/oitsjustjose/criss_cross/lib/Config.java index 0271397..983f15e 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/lib/Config.java +++ b/src/main/java/com/oitsjustjose/criss_cross/lib/Config.java @@ -21,6 +21,7 @@ public class Config public static ConfigCategory Electroextractor; public static ConfigCategory Woodchipper; public static ConfigCategory OtherMachines; + public static ConfigCategory FeatureControl; // Cropomator Configs public static int cropomatorProcessTime; public static int cropomatorOutput; @@ -41,11 +42,22 @@ public class Config public static int woodchipperProcessTime; public static int woodchipperOutput; public static String woodchipperRecipeItem; - // Scribe Configs + // Scribe Configs public static String[] scribeRecipes; public static String[] defaultScribeRecipes = new String[] { "minecraft:fish:3*16=6", "minecraft:spider_eye:0*8=18", "minecraft:obsidian:0*8=3", "minecraft:prismarine_shard:0*16=8", "minecraft:feather:0*32=2", "minecraft:blaze_rod:0*8=20", "minecraft:blaze_powder:0*16=50", "minecraft:piston:0*4=19", "minecraft:prismarine_crystals:0*16=61", "minecraft:fish:0*16=62", "minecraft:potion:8269*1=5", "minecraft:slime:0*8=33", "minecraft:rotten_flesh:0*48=17", "minecraft:double_plant:4*64=7", "ingotIron*24=34", "ingotGold*12=49", "gemQuartz*16=48", "gemDiamond*8=51", "gemEmerald*3=21", "logWood*16=4", "blockIron*4=0", "blockQuartz*16=16", "blockLapis*12=35", "blockRedstone*8=32" }; // Block Generator Configs (stone and cobble) public static int blockGeneratorProcessTimes; + // Feature enabler + public static boolean enableCropomator; + public static boolean enableElectroextractor; + public static boolean enableWoodchipper; + public static boolean enableCobblestoneGenerator; + public static boolean enableStoneGenerator; + public static boolean enableScribe; + public static boolean enablePouches; + public static boolean enableMantlesmashers; + public static boolean enableInfiniapple; + public static boolean enableBuckets; public static void init(File configFile) { @@ -156,6 +168,55 @@ public class Config OtherMachines.setPropertyOrder(propertyOrder); + // Feature Control + category = "feature control"; + propertyOrder = Lists.newArrayList(); + FeatureControl = config.getCategory(category); + config.setCategoryRequiresMcRestart(category, true); + config.setCategoryComment(category, "Enable / Disable Features"); + + property = config.get(category, "Cropomator", true); + enableCropomator = property.getBoolean(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Electroextractor", true); + enableElectroextractor = property.getBoolean(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Woodchipper", true); + enableWoodchipper = property.getBoolean(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Cobblestone Generator", true); + enableCobblestoneGenerator = property.getBoolean(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Stone Generator", true); + enableStoneGenerator = property.getBoolean(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Scribe", true); + enableScribe = property.getBoolean(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Pouches", true); + enablePouches = property.getBoolean(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Mantle Smashers", true); + enableMantlesmashers = property.getBoolean(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Infiniapple", true); + enableInfiniapple = property.getBoolean(); + propertyOrder.add(property.getName()); + + property = config.get(category, "Special Buckets", true); + enableBuckets = property.getBoolean(); + propertyOrder.add(property.getName()); + + FeatureControl.setPropertyOrder(propertyOrder); + if (config.hasChanged()) config.save(); diff --git a/src/main/java/com/oitsjustjose/criss_cross/lib/LibBlocks.java b/src/main/java/com/oitsjustjose/criss_cross/lib/LibBlocks.java index 933ffde..1a18eb9 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/lib/LibBlocks.java +++ b/src/main/java/com/oitsjustjose/criss_cross/lib/LibBlocks.java @@ -21,12 +21,17 @@ public class LibBlocks public static void init() { - cropomator = new BlockCropomator(); - electroextractor = new BlockElectroextractor(); - woodchipper = new BlockWoodchipper(); - cobblegen = new BlockCobblegen(); - stonegen = new BlockStonegen(); - scribe = new BlockScribe(); - // TODO: atmosManipulator = new BlockAtmosManipulator(); + if (Config.enableCropomator) + cropomator = new BlockCropomator(); + if (Config.enableElectroextractor) + electroextractor = new BlockElectroextractor(); + if (Config.enableWoodchipper) + woodchipper = new BlockWoodchipper(); + if (Config.enableCobblestoneGenerator) + cobblegen = new BlockCobblegen(); + if (Config.enableStoneGenerator) + stonegen = new BlockStonegen(); + if (Config.enableScribe) + scribe = new BlockScribe(); } } \ No newline at end of file diff --git a/src/main/java/com/oitsjustjose/criss_cross/lib/LibItems.java b/src/main/java/com/oitsjustjose/criss_cross/lib/LibItems.java index f21876f..517d017 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/lib/LibItems.java +++ b/src/main/java/com/oitsjustjose/criss_cross/lib/LibItems.java @@ -29,18 +29,25 @@ public class LibItems public static void init() { - mkI = EnumHelper.addToolMaterial("mkI", 7, 6244, 8.0F, -2.0F, 10); - mkI.setRepairItem(new ItemStack(Blocks.emerald_block)); - mkII = EnumHelper.addToolMaterial("mkII", 10, -1, 12.0F, -2.0F, 32); + if (Config.enableMantlesmashers) + { + mkI = EnumHelper.addToolMaterial("mkI", 7, 6244, 8.0F, -2.0F, 10); + mkI.setRepairItem(new ItemStack(Blocks.emerald_block)); + mkII = EnumHelper.addToolMaterial("mkII", 10, -1, 12.0F, -2.0F, 32); - dusts = new ItemDust(); - buckets = new ItemModBuckets(); - infiniApple = new ItemInfiniApple(); - pouch = new ItemPouch(); - - mantleSmasherMkI = new ItemMantleSmasher(mkI); - mantleSmasherMkII = new ItemMantleSmasher(mkII); - - FluidContainerRegistry.registerFluidContainer(new FluidStack(FluidRegistry.WATER, 4000), new ItemStack(buckets, 1, 0), new ItemStack(buckets, 1, 0)); + mantleSmasherMkI = new ItemMantleSmasher(mkI); + mantleSmasherMkII = new ItemMantleSmasher(mkII); + } + if (Config.enableElectroextractor) + dusts = new ItemDust(); + if (Config.enableBuckets) + { + buckets = new ItemModBuckets(); + FluidContainerRegistry.registerFluidContainer(new FluidStack(FluidRegistry.WATER, 4000), new ItemStack(buckets, 1, 0), new ItemStack(buckets, 1, 0)); + } + if (Config.enableInfiniapple) + infiniApple = new ItemInfiniApple(); + if (Config.enablePouches) + pouch = new ItemPouch(); } } \ No newline at end of file