fix OOB crash

This commit is contained in:
PrototypeTrousers
2023-02-13 01:02:59 -03:00
parent e09ec8c420
commit ede2b4ce25
2 changed files with 36 additions and 32 deletions
@@ -115,6 +115,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
@Override @Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
if (slotId >= 0 && slotId < this.inventorySlots.size()) {
if (clickTypeIn == ClickType.PICKUP && dragType == 1) { if (clickTypeIn == ClickType.PICKUP && dragType == 1) {
if (this.inventorySlots.get(slotId) == magnetSlot) { if (this.inventorySlots.get(slotId) == magnetSlot) {
ItemStack itemStack = magnetSlot.getStack(); ItemStack itemStack = magnetSlot.getStack();
@@ -135,6 +136,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
} }
} }
} }
}
return super.slotClick(slotId, dragType, clickTypeIn, player); return super.slotClick(slotId, dragType, clickTypeIn, player);
} }
@@ -164,6 +164,7 @@ public class ContainerWirelessPatternTerminal extends ContainerPatternEncoder im
@Override @Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
if (slotId >= 0 && slotId < this.inventorySlots.size()) {
if (clickTypeIn == ClickType.PICKUP && dragType == 1) { if (clickTypeIn == ClickType.PICKUP && dragType == 1) {
if (this.inventorySlots.get(slotId) == magnetSlot) { if (this.inventorySlots.get(slotId) == magnetSlot) {
ItemStack itemStack = magnetSlot.getStack(); ItemStack itemStack = magnetSlot.getStack();
@@ -184,6 +185,7 @@ public class ContainerWirelessPatternTerminal extends ContainerPatternEncoder im
} }
} }
} }
}
return super.slotClick(slotId, dragType, clickTypeIn, player); return super.slotClick(slotId, dragType, clickTypeIn, player);
} }