From 970bfea08c893da3ad165af0b71f3b65ecda3f3f Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 13 Jul 2015 03:50:12 +0200 Subject: [PATCH] Fixed what I just did --- .../actuallyadditions/config/ConfigValues.java | 2 +- .../crafting/ItemCrafting.java | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java index 873aed08c..b66cdaecd 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/ConfigValues.java @@ -32,6 +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'."); + mashedFoodCraftingExceptions = config.getStringList("Mashed Food Crafting Exceptions", ConfigCategories.ITEMS_CRAFTING.name, new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can not be used to craft Mashed Food. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."); } } diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java index 0fe3adb08..635abf082 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/ItemCrafting.java @@ -19,8 +19,6 @@ 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(){ @@ -281,14 +279,21 @@ public class ItemCrafting{ public static void initMashedFoodRecipes(){ if(ConfigCrafting.MASHED_FOOD.isEnabled()){ - for(Object nextIterator : Item.itemRegistry){ - if(nextIterator instanceof ItemFood || nextIterator instanceof IPlantable || nextIterator instanceof IGrowable){ - if(!Arrays.asList(ConfigValues.mashedFoodCraftingExceptions).contains(Item.itemRegistry.getNameForObject(nextIterator))){ - ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD); + for(Object item : Item.itemRegistry){ + if(item instanceof ItemFood || item instanceof IPlantable || item instanceof IGrowable){ + if(!isBlacklisted(item)){ + ItemStack ingredient = new ItemStack((Item)item, 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)); } } } } } + + private static boolean isBlacklisted(Object item){ + for(String except : ConfigValues.mashedFoodCraftingExceptions){ + if(Item.itemRegistry.getNameForObject(item).equals(except)) return true; + } + return false; + } }