add null check to prevent crashing (#280)

This commit is contained in:
MCTBL authored and GitHub committed 2026-05-06 01:11:27 -04:00
1 parent fb2b444e39
commit 7a886eefb9
2 files changed
+8 -5

No files matched your search

@@ -101,12 +101,14 @@ public class PatternShaperChestContainer extends Container {
}
// special for shift click the output pattern
if (slotId == 1) {
this.inventorySlots.get(0).decrStackSize(1);
Slot blankPatternSlot = this.inventorySlots.get(0);
// special for shift click the output pattern
blankPatternSlot.decrStackSize(1);
// if there still have blank pattern
if (this.inventorySlots.get(0).getStack().stackSize != 0) {
if (blankPatternSlot.getHasStack() && blankPatternSlot.getStack().stackSize != 0) {
ItemStack stackCopy = stack.copy();
stackCopy.stackSize = 1;
this.inventorySlots.get(1).putStack(stackCopy);
this.inventorySlots.get(1).putStack(stack.copy());
}
}
} else {