The very best way to do this is with Extra-Utils rationing pipes which are "It will add exactly a stack of an item to a connecting inventory. It is highly useful when you need to keep multiple different items in an inventory and need to prevent one item from taking up all the inventory slots"...