use of minechem.potion.PotionChemical in project Minechem by iopleke.
the class SynthesisRecipeHandler method itemStacksMatchesShapelessRecipe.
private boolean itemStacksMatchesShapelessRecipe(ItemStack[] stacks, SynthesisRecipe recipe, int factor) {
ArrayList<ItemStack> stacksList = new ArrayList<ItemStack>();
ArrayList<ItemStack> shapelessRecipe = MinechemUtil.convertChemicalsIntoItemStacks(new ArrayList<PotionChemical>(Arrays.asList(recipe.getShapelessRecipe())));
for (ItemStack itemstack : stacks) {
if (itemstack != null) {
stacksList.add(itemstack.copy());
}
}
for (ItemStack itemstack : stacksList) {
int ingredientSlot = getIngredientSlotThatMatchesStack(shapelessRecipe, itemstack, 1);
if (ingredientSlot != -1) {
shapelessRecipe.remove(ingredientSlot);
} else {
return false;
}
}
return shapelessRecipe.size() == 0;
}
Aggregations