From 4841edb8d756fb2f8a42d62593376dcbcc7a6fdd Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Wed, 17 Dec 2014 18:58:37 -0500 Subject: [PATCH] Fix farm crashing when IO config is pressed --- .../block/BlockDarkSteelPressurePlate.java | 1 + .../enderio/machine/farm/GuiFarmStation.java | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/crazypants/enderio/block/BlockDarkSteelPressurePlate.java b/src/main/java/crazypants/enderio/block/BlockDarkSteelPressurePlate.java index 67c99d28..b9093130 100644 --- a/src/main/java/crazypants/enderio/block/BlockDarkSteelPressurePlate.java +++ b/src/main/java/crazypants/enderio/block/BlockDarkSteelPressurePlate.java @@ -137,6 +137,7 @@ public class BlockDarkSteelPressurePlate extends BlockPressurePlate implements I return super.colorMultiplier(world, x, y, z); } + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override @SideOnly(Side.CLIENT) public void getSubBlocks(Item arg0, CreativeTabs arg1, List items) { diff --git a/src/main/java/crazypants/enderio/machine/farm/GuiFarmStation.java b/src/main/java/crazypants/enderio/machine/farm/GuiFarmStation.java index 5d1f6fa7..0a340147 100644 --- a/src/main/java/crazypants/enderio/machine/farm/GuiFarmStation.java +++ b/src/main/java/crazypants/enderio/machine/farm/GuiFarmStation.java @@ -49,12 +49,14 @@ public class GuiFarmStation extends GuiPoweredMachineBase { @Override protected void drawForegroundImpl(int mouseX, int mouseY) { super.drawForegroundImpl(mouseX, mouseY); - + if(inventorySlots.inventorySlots.size() >= farm.maxSupSlot && !isConfigOverlayEnabled()) { for (int i : farm.lockedSlots) { - Slot slot = inventorySlots.getSlot(i); - GL11.glEnable(GL11.GL_BLEND); - RenderUtil.renderQuad2D(slot.xDisplayPosition, slot.yDisplayPosition, 0, 16, 16, new Vector4f(0, 0, 0, 0.5)); + if (i < inventorySlots.inventorySlots.size()) { // hack to allow old broken farms to be opened + Slot slot = inventorySlots.getSlot(i); + GL11.glEnable(GL11.GL_BLEND); + RenderUtil.renderQuad2D(slot.xDisplayPosition, slot.yDisplayPosition, 0, 16, 16, new Vector4f(0, 0, 0, 0.5)); + } } } } @@ -83,7 +85,10 @@ public class GuiFarmStation extends GuiPoweredMachineBase { @Override protected void actionPerformed(GuiButton b) { - farm.toggleLockedState(b.id); + if (b instanceof ToggleButtonEIO) { + farm.toggleLockedState(b.id); + } + super.actionPerformed(b); } @Override