_service.getOrderManager().deferSend();
break;
}
lastAccessedCrafter = new WeakReference<TileEntity>(tile.tile);
// send the new crafted items to the destination
ItemIdentifier extractedID = ItemIdentifier.get(extracted);
while (extracted.stackSize > 0) {
if(!nextOrder.getItem().getItem().equals(extractedID)) {
LogisticsOrder startOrder = nextOrder;
if(_service.getOrderManager().hasOrders(RequestType.CRAFTING)) {
do {
_service.getOrderManager().deferSend();
nextOrder = _service.getOrderManager().peekAtTopRequest(RequestType.CRAFTING);
} while(!nextOrder.getItem().getItem().equals(extractedID) && startOrder != nextOrder);
}
if(startOrder == nextOrder) {
int numtosend = Math.min(extracted.stackSize, extractedID.getMaxStackSize());
if(numtosend == 0)
break;
stacksleft -= 1;
itemsleft -= numtosend;
ItemStack stackToSend = extracted.splitStack(numtosend);
//Route the unhandled item
_service.sendStack(stackToSend, -1, ItemSendMode.Normal, null) ;
continue;
}
}
int numtosend = Math.min(extracted.stackSize, extractedID.getMaxStackSize());
numtosend = Math.min(numtosend, nextOrder.getItem().getStackSize());
if(numtosend == 0)
break;
stacksleft -= 1;
itemsleft -= numtosend;