From 2c7d498bb931548aca82dabf0988572267f0410b Mon Sep 17 00:00:00 2001 From: GlodBlock <60341015+GlodBlock@users.noreply.github.com> Date: Fri, 6 Aug 2021 22:52:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=8B=E7=BC=A9=E5=90=8C=E7=B1=BB=E7=89=A9?= =?UTF-8?q?=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vfyjxf/nee/nei/NEECraftingHandler.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java index b7d74ad..7d6f1dc 100644 --- a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java @@ -15,6 +15,7 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import java.util.ArrayList; import java.util.List; /** @@ -50,8 +51,27 @@ public class NEECraftingHandler implements IOverlayHandler { for (IRecipeProcessor processor : RecipeProcessor.recipeProcessors) { List inputs = processor.getRecipeInput(recipe, recipeIndex, identifier); List outputs = processor.getRecipeOutput(recipe, recipeIndex, identifier); + + List tInputs = new ArrayList<>(); + if (inputs != null && outputs != null) { + for (PositionedStack positionedStack : inputs) { + ItemStack currentStack = positionedStack.items[0]; + boolean find = false; + for (PositionedStack storedStack : tInputs) { + ItemStack StoredStack = storedStack.items[0]; + if (StoredStack.isItemEqual(currentStack) && (StoredStack.stackSize + currentStack.stackSize) <= StoredStack.getMaxStackSize()) { + find = true; + storedStack.items[0].stackSize = StoredStack.stackSize + currentStack.stackSize; + } + } + if (!find) { + tInputs.add(positionedStack); + } + } + + for (PositionedStack positionedStack : tInputs) { ItemStack currentStack = positionedStack.items[0]; for (ItemStack stack : positionedStack.items) { if (Platform.isRecipePrioritized(stack)) {