From 8598b484adfebef6039c3459edbccfabc03c53e0 Mon Sep 17 00:00:00 2001 From: Pirulax Date: Mon, 7 Jul 2025 00:16:34 +0200 Subject: [PATCH 1/3] Fix crafting recipe with multiple items in the same slot not imported correctly into crafting module/pipe --- .../proxy/recipeproviders/LogisticsCraftingTable.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java b/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java index 8928aa4b9..152e83219 100644 --- a/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java +++ b/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java @@ -38,12 +38,7 @@ public boolean importRecipe(TileEntity tile, IItemIdentifierInventory inventory) if (i >= inventory.getSizeInventory() - 2) { break; } - ItemStack stackInSlot = bench.matrix.getStackInSlot(i); - if (!stackInSlot.isEmpty() && stackInSlot.getCount() > 1) { - stackInSlot = stackInSlot.copy(); - stackInSlot.setCount(1); - } - inventory.setInventorySlotContents(i, stackInSlot); + inventory.setInventorySlotContents(i, bench.matrix.getStackInSlot(i)); } if (!bench.isFuzzy()) { From 91400705329ac2f73ba6cdec511ff8fffb17c6a3 Mon Sep 17 00:00:00 2001 From: Pirulax Date: Mon, 7 Jul 2025 00:20:36 +0200 Subject: [PATCH 2/3] Improve for loop --- .../proxy/recipeproviders/LogisticsCraftingTable.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java b/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java index 152e83219..4ec77ce69 100644 --- a/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java +++ b/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java @@ -1,6 +1,5 @@ package logisticspipes.proxy.recipeproviders; -import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity; @@ -34,10 +33,7 @@ public boolean importRecipe(TileEntity tile, IItemIdentifierInventory inventory) inventory.setInventorySlotContents(9, result); // Import - for (int i = 0; i < bench.matrix.getSizeInventory(); i++) { - if (i >= inventory.getSizeInventory() - 2) { - break; - } + for (int i = 0; i < Math.min(bench.matrix.getSizeInventory(), inventory.getSizeInventory() - 2); i++) { inventory.setInventorySlotContents(i, bench.matrix.getStackInSlot(i)); } From 29f339e3927ff380a6bec08666ccdf215f757ea2 Mon Sep 17 00:00:00 2001 From: Pirulax Date: Mon, 7 Jul 2025 23:40:36 +0200 Subject: [PATCH 3/3] Fix code, use non-deprecated method --- .../recipeproviders/LogisticsCraftingTable.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java b/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java index 4ec77ce69..2df0d82ff 100644 --- a/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java +++ b/common/logisticspipes/proxy/recipeproviders/LogisticsCraftingTable.java @@ -1,5 +1,7 @@ package logisticspipes.proxy.recipeproviders; +import logisticspipes.utils.tuples.Pair; + import net.minecraft.tileentity.TileEntity; import logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity; @@ -30,11 +32,15 @@ public boolean importRecipe(TileEntity tile, IItemIdentifierInventory inventory) return false; } + // Craft result is slot 9 inventory.setInventorySlotContents(9, result); - // Import - for (int i = 0; i < Math.min(bench.matrix.getSizeInventory(), inventory.getSizeInventory() - 2); i++) { - inventory.setInventorySlotContents(i, bench.matrix.getStackInSlot(i)); + // Import (Slots [0, 8]) + for (Pair slot : bench.matrix) { + final int i = slot.getValue2(); + if (i <= inventory.getSizeInventory() - 2) { + inventory.setInventorySlotContents(i, slot.getValue1().makeNormalStack()); + } } if (!bench.isFuzzy()) {