mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-22 13:09:53 +00:00
add null check to prevent crashing (#280)
This commit is contained in:
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 {
|
||||
|
||||
@@ -81,10 +81,11 @@ public class PatternShaperContainer extends Container {
|
||||
return null;
|
||||
}
|
||||
if (stack.getItem() instanceof IPattern && slotId == 1) {
|
||||
Slot blankPatternSlot = this.inventorySlots.get(0);
|
||||
// special for shift click the output pattern
|
||||
this.inventorySlots.get(0).decrStackSize(1);
|
||||
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(stack.copy());
|
||||
|
||||
Reference in new issue
Block a user