package blusunrize.immersiveengineering.common.crafting;
import blusunrize.immersiveengineering.common.IEContent;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.oredict.OreDictionary;
public class RecipeRevolver implements IRecipe
{
@Override
public boolean matches(InventoryCrafting inv, World world)
{
ItemStack revolver = null;
for(int i=0;i<inv.getSizeInventory();i++)
{
ItemStack stackInSlot = inv.getStackInSlot(i);
if(stackInSlot!=null)
{
if(revolver==null && OreDictionary.itemMatches(new ItemStack(IEContent.itemRevolver,1,OreDictionary.WILDCARD_VALUE), stackInSlot, false) && stackInSlot.getItemDamage()!=1)
revolver = stackInSlot;
else
return false;
}
}
return revolver!=null;
}
@Override
public ItemStack getCraftingResult(InventoryCrafting inv)
{
ItemStack revolver = null;
for(int i=0;i<inv.getSizeInventory();i++)
{
ItemStack stackInSlot = inv.getStackInSlot(i);
if(stackInSlot!=null)
{
if(revolver==null && OreDictionary.itemMatches(new ItemStack(IEContent.itemRevolver,1,OreDictionary.WILDCARD_VALUE), stackInSlot, false) && stackInSlot.getItemDamage()!=1)
revolver = stackInSlot.copy();
else
return null;
}
}
return revolver;
}
@Override
public int getRecipeSize()
{
return 10;
}
@Override
public ItemStack getRecipeOutput()
{
return null;
}
@Override
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
}
}