equivalent-exchange-3/common/com/pahimar/ee3/item/crafting/RecipesVanilla.java
2013-10-06 21:50:43 -04:00

47 lines
1.3 KiB
Java

package com.pahimar.ee3.item.crafting;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.pahimar.ee3.core.util.RecipeHelper;
import com.pahimar.ee3.item.CustomWrappedStack;
public class RecipesVanilla {
private static Multimap<CustomWrappedStack, List<CustomWrappedStack>> vanillaRecipes = null;
public static Multimap<CustomWrappedStack, List<CustomWrappedStack>> getVanillaRecipes() {
if (vanillaRecipes == null) {
init();
}
return vanillaRecipes;
}
private static void init() {
vanillaRecipes = HashMultimap.create();
for (Object recipeObject : CraftingManager.getInstance().getRecipeList()) {
if (recipeObject instanceof IRecipe) {
IRecipe recipe = (IRecipe) recipeObject;
ItemStack recipeOutput = recipe.getRecipeOutput();
if (recipeOutput != null) {
ArrayList<CustomWrappedStack> recipeInputs = RecipeHelper.getRecipeInputs(recipe);
vanillaRecipes.put(new CustomWrappedStack(recipeOutput), recipeInputs);
}
}
}
}
}