Repository: refinedmods/refinedstorage
Issue: Processing recipes ignore first slot when transferred into crafting grid

#### Issue description:
Processing recipes ignore first slot when transferred into crafting grid

#### Steps to reproduce:
1. transfer processing recipe through JEI
2.
3.
...

#### Version (make sure you are on the latest version before reporting):

- Minecraft: 1.16.3
- Forge: 34.1.25
- Refined Storage: 1.9.8

Crafting recipes put the output as first slot. That slot is being skipped here: https://github.com/refinedmods/refinedstorage/blob/512077e88011d8d9ceaef408706e75c5253084d5/src/main/java/com/refinedmods/refinedstorage/network/grid/GridTransferMessage.java#L55

Not sure what a good solution would be. 

Changed files:
src/main/java/com/refinedmods/refinedstorage/apiimpl/network/grid/CraftingGridBehavior.java
src/main/java/com/refinedmods/refinedstorage/integration/jei/GridRecipeTransferHandler.java
src/main/java/com/refinedmods/refinedstorage/network/grid/GridTransferMessage.java

diff --git a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/grid/CraftingGridBehavior.java b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/grid/CraftingGridBehavior.java
index 1b64827bd..0ce7ad08f 100644
--- a/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/grid/CraftingGridBehavior.java
+++ b/src/main/java/com/refinedmods/refinedstorage/apiimpl/network/grid/CraftingGridBehavior.java
@@ -211,7 +211,7 @@ public class CraftingGridBehavior implements ICraftingGridBehavior {
                     // If we are connected, first try to get the possibilities from the network
                     if (network != null && grid.isGridActive()) {
                         for (ItemStack possibility : possibilities) {
-                            ItemStack took = network.extractItem(possibility, 1, IComparer.COMPARE_NBT, Action.PERFORM);
+                            ItemStack took = network.extractItem(possibility, possibility.getCount(), IComparer.COMPARE_NBT, Action.PERFORM);
 
                             if (!took.isEmpty()) {
                                 grid.getCraftingMatrix().setInventorySlotContents(i, took);
diff --git a/src/main/java/com/refinedmods/refinedstorage/integration/jei/GridRecipeTransferHandler.java b/src/main/java/com/refinedmods/refinedstorage/integration/jei/GridRecipeTransferHandler.java
index bbb321d63..5213465cc 100644
--- a/src/main/java/com/refinedmods/refinedstorage/integration/jei/GridRecipeTransferHandler.java
+++ b/src/main/java/com/refinedmods/refinedstorage/integration/jei/GridRecipeTransferHandler.java
@@ -153,7 +153,8 @@ public class GridRecipeTransferHandler implements IRecipeTransferHandler<GridCon
     private void move(GridContainer gridContainer, IRecipeLayout recipeLayout) {
         RS.NETWORK_HANDLER.sendToServer(new GridTransferMessage(
             recipeLayout.getItemStacks().getGuiIngredients(),
-            gridContainer.inventorySlots.stream().filter(s -> s.inventory instanceof CraftingInventory).collect(Collectors.toList())
+            gridContainer.inventorySlots.stream().filter(s -> s.inventory instanceof CraftingInventory).collect(Collectors.toList()),
+                recipeLayout.getRecipeCategory().getUid().equals(VanillaRecipeCategoryUid.CRAFTING)
         ));
     }
 
diff --git a/src/main/java/com/refinedmods/refinedstorage/network/grid/GridTransferMessage.java b/src/main/java/com/refinedmods/refinedstorage/network/grid/GridTransferMessage.java
index 684dd5bc4..18b6f2b67 100644
--- a/src/main/java/com/refinedmods/refinedstorage/network/grid/GridTransferMessage.java
+++ b/src/main/java/com/refinedmods/refinedstorage/network/grid/GridTransferMessage.java
@@ -19,15 +19,17 @@ import java.util.function.Supplier;
 public class GridTransferMessage {
     private Map<Integer, ? extends IGuiIngredient<ItemStack>> inputs;
     private List<Slot> slots;
+    boolean isCraftingRecipe;
 
     private final ItemStack[][] recipe = new ItemStack[9][];
 
     public GridTransferMessage() {
     }
 
-    public GridTransferMessage(Map<Integer, ? extends IGuiIngredient<ItemStack>> inputs, List<Slot> slots) {
+    public GridTransferMessage(Map<Integer, ? extends IGuiIngredient<ItemStack>> inputs, List<Slot> slots, boolean isCraftingRecipe) {
         this.inputs = inputs;
         this.slots = slots;
+        this.isCraftingRecipe = isCraftingRecipe;
     }
 
     public static GridTransferMessage decode(PacketBuffer buf) {
@@ -52,7 +54,7 @@ public class GridTransferMessage {
         buf.writeInt(message.slots.size());
 
         for (Slot slot : message.slots) {
-            IGuiIngredient<ItemStack> ingredient = message.inputs.get(slot.getSlotIndex() + 1);
+            IGuiIngredient<ItemStack> ingredient = message.inputs.get(slot.getSlotIndex() + (message.isCraftingRecipe ? 1 : 0));
 
             List<ItemStack> ingredients = new ArrayList<>();