int requiredAmount = (required.getAmount() - currentAmount);
if (requiredAmount <= 0) continue;
for (int j = 0; j < contents.length; j++) {
ItemStack contentsStack = contents[j];
if (contentsStack == null) continue;
if ((stack == null) ? required.matches(contentsStack)
: StackUtils.matches(stack, contentsStack)) {
int amount = Math.min(contentsStack.stackSize, requiredAmount);
crafting[i] = stack = StackUtils.copyStack(contentsStack, (currentAmount += amount));
contents[j] = StackUtils.copyStack(contentsStack, contentsStack.stackSize - amount);
if ((requiredAmount -= amount) <= 0)