From 8d52dbbb94ae2cf97555facba9920c5ece8de916 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 13 Jul 2015 03:28:04 +0200 Subject: [PATCH] Added a Config Option for Mashed Food Crafting Blacklisting --- .../config/ConfigValues.java | 2 + .../crafting/ItemCrafting.java | 9 ++++- .../items/InitForeignPaxels.java | 40 ++++++++++--------- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java index 25d8c9a38..873aed08c 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java @@ -14,6 +14,7 @@ public class ConfigValues{ public static ConfigBoolValues[] boolConfig = ConfigBoolValues.values(); public static String[] crusherRecipeExceptions; + public static String[] mashedFoodCraftingExceptions; public static void defineConfigValues(Configuration config){ @@ -31,5 +32,6 @@ public class ConfigValues{ } crusherRecipeExceptions = config.getStringList("Crusher Recipe Exceptions", ConfigCategories.CRUSHER_RECIPES.name, new String[]{"ingotBrick", "ingotBrickNether"}, "The Ingots, Dusts and Ores blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only."); + mashedFoodCraftingExceptions = config.getStringList("Mashed Food Crafting Exceptions", ConfigCategories.ITEMS_CRAFTING.name, new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can't be used to craft Mashed Food. These are the actual Item Names, the ones you use, for example, when using the /give Command. Always ModName:ItemName, for example 'Minecraft:stone' or 'ActuallyAdditions:itemHoeObsidian'."); } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index f81d74809..0fe3adb08 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.crafting; import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; +import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigCrafting; import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.metalists.*; @@ -18,6 +19,8 @@ import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; +import java.util.Arrays; + public class ItemCrafting{ public static void init(){ @@ -280,8 +283,10 @@ public class ItemCrafting{ if(ConfigCrafting.MASHED_FOOD.isEnabled()){ for(Object nextIterator : Item.itemRegistry){ if(nextIterator instanceof ItemFood || nextIterator instanceof IPlantable || nextIterator instanceof IGrowable){ - ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD); - GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD)); + if(!Arrays.asList(ConfigValues.mashedFoodCraftingExceptions).contains(Item.itemRegistry.getNameForObject(nextIterator))){ + ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD); + GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD)); + } } } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java index a8c02c8ed..e6d3393d6 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitForeignPaxels.java @@ -17,25 +17,29 @@ import java.util.List; public class InitForeignPaxels{ + private static final String THERMAL_FOUNDATION = "ThermalFoundation"; + private static final String MEKANISM_TOOLS = "MekanismTools"; + public static Item[] tfPaxels = new Item[9]; private static final String[] tfNames = new String[]{"Copper", "Tin", "Silver", "Lead", "Nickel", "Electrum", "Bronze", "Platinum", "Invar"}; + private static Item[] mtPaxels = new Item[6]; - private static final String[] mtRepairNames = new String[]{"ingotRefinedObsidian", "gemLapis", "ingotOsmium", "ingotBronze", "ingotRefinedGlowstone", "ingotSteel"}; public static final String[] mtNames = new String[]{"Obsidian", "LapisLazuli", "Osmium", "Bronze", "Glowstone", "Steel"}; + private static final String[] mtRepairNames = new String[]{"ingotRefinedObsidian", "gemLapis", "ingotOsmium", "ingotBronze", "ingotRefinedGlowstone", "ingotSteel"}; public static void init(){ //MekanismTools if(ConfigBoolValues.MT_PAXELS.isEnabled()){ - if(Loader.isModLoaded("MekanismTools")){ - ModUtil.LOGGER.info("Initializing MekanismTools Material Paxels..."); + if(Loader.isModLoaded(MEKANISM_TOOLS)){ + ModUtil.LOGGER.info("Initializing "+MEKANISM_TOOLS+" AIOTs..."); for(int i = 0; i < mtPaxels.length; i++){ - if(!(!ConfigBoolValues.DUPLICATE_PAXELS.isEnabled() && (i == 0 || (i == 3 && ConfigBoolValues.TF_PAXELS.isEnabled() && Loader.isModLoaded("ThermalFoundation"))))){ - Item axe = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Axe"); - Item pickaxe = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Pickaxe"); - Item hoe = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Hoe"); - Item sword = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Sword"); - Item shovel = ItemUtil.getItemFromName("MekanismTools:"+mtNames[i]+"Shovel"); + if(!(!ConfigBoolValues.DUPLICATE_PAXELS.isEnabled() && (i == 0 || (i == 3 && ConfigBoolValues.TF_PAXELS.isEnabled() && Loader.isModLoaded(THERMAL_FOUNDATION))))){ + Item axe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+mtNames[i]+"Axe"); + Item pickaxe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+mtNames[i]+"Pickaxe"); + Item hoe = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+mtNames[i]+"Hoe"); + Item sword = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+mtNames[i]+"Sword"); + Item shovel = ItemUtil.getItemFromName(MEKANISM_TOOLS+":"+mtNames[i]+"Shovel"); if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){ Item.ToolMaterial material = ((ItemTool)axe).func_150913_i(); @@ -49,20 +53,20 @@ public class InitForeignPaxels{ } } } - else ModUtil.LOGGER.info("MekanismTools not loaded, can't initialize special Paxels."); + else ModUtil.LOGGER.info(MEKANISM_TOOLS+" not loaded, can't initialize Special AIOTs."); } //Thermal Foundation if(ConfigBoolValues.TF_PAXELS.isEnabled()){ - if(Loader.isModLoaded("ThermalFoundation")){ - ModUtil.LOGGER.info("Initializing Thermal Foundation Material Paxels..."); + if(Loader.isModLoaded(THERMAL_FOUNDATION)){ + ModUtil.LOGGER.info("Initializing "+THERMAL_FOUNDATION+" AIOTs..."); for(int i = 0; i < tfPaxels.length; i++){ - Item axe = ItemUtil.getItemFromName("ThermalFoundation:tool.axe"+tfNames[i]); - Item pickaxe = ItemUtil.getItemFromName("ThermalFoundation:tool.pickaxe"+tfNames[i]); - Item hoe = ItemUtil.getItemFromName("ThermalFoundation:tool.hoe"+tfNames[i]); - Item sword = ItemUtil.getItemFromName("ThermalFoundation:tool.sword"+tfNames[i]); - Item shovel = ItemUtil.getItemFromName("ThermalFoundation:tool.shovel"+tfNames[i]); + Item axe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.axe"+tfNames[i]); + Item pickaxe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.pickaxe"+tfNames[i]); + Item hoe = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.hoe"+tfNames[i]); + Item sword = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.sword"+tfNames[i]); + Item shovel = ItemUtil.getItemFromName(THERMAL_FOUNDATION+":tool.shovel"+tfNames[i]); if(axe != null && pickaxe != null && hoe != null && sword != null && shovel != null && axe instanceof ItemTool){ Item.ToolMaterial material = ((ItemTool)axe).func_150913_i(); @@ -75,7 +79,7 @@ public class InitForeignPaxels{ } } } - else ModUtil.LOGGER.info("Thermal Foundation not loaded, can't initialize special Paxels."); + else ModUtil.LOGGER.info(THERMAL_FOUNDATION+" not loaded, can't initialize Special AIOTs."); } }