public ItemStack findMatchingRecipe(InventoryCrafting inventorycrafting) { for (int i = 0; i < recipes.size(); i++) { IRecipe irecipe = (IRecipe) recipes.get(i); if (irecipe.matches(inventorycrafting)) { return irecipe.getCraftingResult(inventorycrafting); } } return null; }
public ItemStack findMatchingRecipe(InventoryCrafting par1InventoryCrafting, World par2World) { int i = 0; ItemStack itemstack = null; ItemStack itemstack1 = null; int j; for (j = 0; j < par1InventoryCrafting.getSizeInventory(); ++j) { ItemStack itemstack2 = par1InventoryCrafting.getStackInSlot(j); if (itemstack2 != null) { if (i == 0) { itemstack = itemstack2; } if (i == 1) { itemstack1 = itemstack2; } ++i; } } if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && itemstack.getItem().isRepairable()) { Item item = itemstack.getItem(); int j1 = item.getMaxDamage() - itemstack.getItemDamageForDisplay(); int k = item.getMaxDamage() - itemstack1.getItemDamageForDisplay(); int l = j1 + k + item.getMaxDamage() * 5 / 100; int i1 = item.getMaxDamage() - l; if (i1 < 0) { i1 = 0; } return new ItemStack(itemstack.getItem(), 1, i1); } else { for (j = 0; j < this.recipes.size(); ++j) { IRecipe irecipe = (IRecipe) this.recipes.get(j); if (irecipe.matches(par1InventoryCrafting, par2World)) { return irecipe.getCraftingResult(par1InventoryCrafting); } } return null; } }
public ItemStack findMatchingRecipe(InventoryCrafting inventorycrafting) { int i = 0; ItemStack itemstack = null; ItemStack itemstack1 = null; for (int j = 0; j < inventorycrafting.getSizeInventory(); j++) { ItemStack itemstack2 = inventorycrafting.getStackInSlot(j); if (itemstack2 == null) { continue; } if (i == 0) { itemstack = itemstack2; } if (i == 1) { itemstack1 = itemstack2; } i++; } if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isDamageable()) { Item item = Item.itemsList[itemstack.itemID]; int l = item.getMaxDamage() - itemstack.getItemDamageForDisplay(); int i1 = item.getMaxDamage() - itemstack1.getItemDamageForDisplay(); int j1 = l + i1 + (item.getMaxDamage() * 10) / 100; int k1 = item.getMaxDamage() - j1; if (k1 < 0) { k1 = 0; } return new ItemStack(itemstack.itemID, 1, k1); } for (int k = 0; k < recipes.size(); k++) { IRecipe irecipe = (IRecipe) recipes.get(k); if (irecipe.matches(inventorycrafting)) { return irecipe.getCraftingResult(inventorycrafting); } } return null; }