/** Find recipes excluding one or more recipe types */ public static ItemStack findMatchingRecipeExcluding( InventoryCrafting inv, World world, Class... excluding) { int i = 0; ItemStack itemstack = null; ItemStack itemstack1 = null; int j; List recipes = CraftingManager.getInstance().getRecipeList(); for (j = 0; j < inv.getSizeInventory(); ++j) { ItemStack itemstack2 = inv.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.getItemDamage(); // getItemDamageForDisplay int k = item.getMaxDamage() - itemstack1.getItemDamage(); 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 < recipes.size(); ++j) { IRecipe irecipe = (IRecipe) recipes.get(j); // 1.1.1 Botania fix (try catch) try { if ((!Arrays.asList(excluding).contains(irecipe.getClass())) && irecipe.matches(inv, world)) { return irecipe.getCraftingResult(inv); } } catch (Exception e) { } } return null; } }
@Override public List<Object> getInputs(IRecipe recipe) { List<Object> ingredients = null; if (recipeClass != null && recipeClass.isInstance(recipe) && inputField != null && checkItemEquals != null) { try { Object[] input = (Object[]) inputField.get(recipe); ingredients = new ArrayList<Object>(Arrays.asList(input)); } catch (Exception e) { Ref.LOGGER.warn("[Mekanism Recipe Scan] " + recipe.getClass().getName() + " failed!", e); return null; } } return ingredients; }