Fix bug with recipes that produce multiple items

* When creating a recipe which creates multiple items (e.g., Pipe Wire in
  Buildcraft), the algorithm would add an extra n-1 items to the inventory.