fix: 有序轧机 NEI 在 setMaxSize 前拷贝输入堆叠

Fixes #4

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
layue13andCursor committed 2026-11-16 00:26:02 +08:00
1 parent ced7fc2f5f
commit 15ee39c84e
1 file changed
+32
@@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Stratum <stratum@localhost>
Date: Mon, 16 Nov 2026 00:23:38 +0800
Subject: [PATCH] fix: copy shaped rolling-machine inputs before setMaxSize
PositionedStack with genPerms=false aliases items[] to the live recipe
stacks. setMaxSize(1) was shrinking those originals; copy them first.
Co-authored-by: Cursor <[email protected]>
---
.../mods/railcraft/RecipeHandlerRollingMachineShaped.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/main/java/tonius/neiintegration/mods/railcraft/RecipeHandlerRollingMachineShaped.java b/src/main/java/tonius/neiintegration/mods/railcraft/RecipeHandlerRollingMachineShaped.java
index c2a4896..baf078a 100644
--- a/src/main/java/tonius/neiintegration/mods/railcraft/RecipeHandlerRollingMachineShaped.java
+++ b/src/main/java/tonius/neiintegration/mods/railcraft/RecipeHandlerRollingMachineShaped.java
@@ -60,7 +60,14 @@ public class RecipeHandlerRollingMachineShaped extends RecipeHandlerRollingMachi
continue;
}
+ // genPerms=false leaves items[] aliased to the live recipe stacks.
PositionedStack stack = new PositionedStack(item, 25 + x * 18, 8 + y * 18, false);
+ ItemStack[] aliased = stack.items;
+ ItemStack[] copies = new ItemStack[aliased.length];
+ for (int i = 0; i < aliased.length; i++) {
+ copies[i] = aliased[i] == null ? null : aliased[i].copy();
+ }
+ stack.items = copies;
stack.setMaxSize(1);
this.inputs.add(stack);
}