2016-06-05 14:12:28 -04:00
|
|
|
package WayofTime.bloodmagic.util.helper;
|
|
|
|
|
2016-06-08 15:36:47 -04:00
|
|
|
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
|
|
|
|
import WayofTime.bloodmagic.api.registry.TartaricForgeRecipeRegistry;
|
2016-06-05 14:12:28 -04:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.item.crafting.CraftingManager;
|
|
|
|
import net.minecraft.item.crafting.IRecipe;
|
|
|
|
|
|
|
|
public class RecipeHelper
|
|
|
|
{
|
|
|
|
public static IRecipe getRecipeForOutput(ItemStack stack)
|
|
|
|
{
|
|
|
|
for (IRecipe recipe : CraftingManager.getInstance().getRecipeList())
|
|
|
|
{
|
|
|
|
if (recipe != null)
|
|
|
|
{
|
|
|
|
ItemStack resultStack = recipe.getRecipeOutput();
|
|
|
|
if (resultStack != null && resultStack.getItem() != null)
|
|
|
|
{
|
|
|
|
if (resultStack.getItem() == stack.getItem() && resultStack.getItemDamage() == stack.getItemDamage())
|
|
|
|
{
|
|
|
|
return recipe;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
2016-06-08 15:36:47 -04:00
|
|
|
|
|
|
|
public static TartaricForgeRecipe getForgeRecipeForOutput(ItemStack stack)
|
|
|
|
{
|
|
|
|
for (TartaricForgeRecipe recipe : TartaricForgeRecipeRegistry.getRecipeList())
|
|
|
|
{
|
|
|
|
if (recipe != null)
|
|
|
|
{
|
|
|
|
ItemStack resultStack = recipe.getRecipeOutput();
|
|
|
|
if (resultStack != null && resultStack.getItem() != null)
|
|
|
|
{
|
|
|
|
if (resultStack.getItem() == stack.getItem() && resultStack.getItemDamage() == stack.getItemDamage())
|
|
|
|
{
|
|
|
|
return recipe;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
2016-06-05 14:12:28 -04:00
|
|
|
}
|