Fixed what I just did

This commit is contained in:
Ellpeck 2015-07-13 03:50:12 +02:00
parent 8d52dbbb94
commit 970bfea08c
2 changed files with 12 additions and 7 deletions

View file

@ -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."); 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.");
} }
} }

View file

@ -19,8 +19,6 @@ import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe;
import java.util.Arrays;
public class ItemCrafting{ public class ItemCrafting{
public static void init(){ public static void init(){
@ -281,14 +279,21 @@ public class ItemCrafting{
public static void initMashedFoodRecipes(){ public static void initMashedFoodRecipes(){
if(ConfigCrafting.MASHED_FOOD.isEnabled()){ if(ConfigCrafting.MASHED_FOOD.isEnabled()){
for(Object nextIterator : Item.itemRegistry){ for(Object item : Item.itemRegistry){
if(nextIterator instanceof ItemFood || nextIterator instanceof IPlantable || nextIterator instanceof IGrowable){ if(item instanceof ItemFood || item instanceof IPlantable || item instanceof IGrowable){
if(!Arrays.asList(ConfigValues.mashedFoodCraftingExceptions).contains(Item.itemRegistry.getNameForObject(nextIterator))){ if(!isBlacklisted(item)){
ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD); 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)); 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;
}
} }