From 049434084795149db138fe87f0f7115abdb2d164 Mon Sep 17 00:00:00 2001 From: ProperSAMA <997794945@qq.com> Date: Sun, 21 Dec 2025 18:35:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E5=A0=86=E5=8F=A0=E7=89=A9=E5=93=81=E5=9C=A8=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E6=97=B6=E8=A2=AB=E5=A0=86=E5=8F=A0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hellfirepvp/modularmachinery/common/util/ItemUtils.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/hellfirepvp/modularmachinery/common/util/ItemUtils.java b/src/main/java/hellfirepvp/modularmachinery/common/util/ItemUtils.java index 3a80b884..28dbb02b 100644 --- a/src/main/java/hellfirepvp/modularmachinery/common/util/ItemUtils.java +++ b/src/main/java/hellfirepvp/modularmachinery/common/util/ItemUtils.java @@ -273,7 +273,8 @@ public static int insertAll(@Nonnull ItemStack stack, IItemHandlerModifiable han int inserted = 0; for (int i = 0; i < handler.getSlots(); i++) { - int maxStackSize = handler.getSlotLimit(i); + // 避免不可堆叠物品被叠加 + int maxStackSize = Math.min(handler.getSlotLimit(i), stack.getMaxStackSize()); ItemStack in = handler.getStackInSlot(i); int count = in.getCount(); if (count >= maxStackSize) { @@ -285,7 +286,8 @@ public static int insertAll(@Nonnull ItemStack stack, IItemHandlerModifiable han handler.setStackInSlot(i, copyStackWithSize(stack, toInsert)); inserted += toInsert; } else { - if (stackEqualsNonNBT(stack, in) && matchTags(stack, in)) { + // 不允许对不可堆叠物品进行合并 + if (stack.isStackable() && stackEqualsNonNBT(stack, in) && matchTags(stack, in)) { int toInsert = Math.min(maxInsert - inserted, maxStackSize - count); handler.setStackInSlot(i, copyStackWithSize(stack, toInsert + count)); inserted += toInsert;