From 9d545e653d61b761cf459caaf5128d2ed40692c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Mon, 3 Mar 2014 00:09:07 +0100 Subject: [PATCH] added side check to avoid potential crash in GUIs --- src/main/java/li/cil/oc/common/container/Robot.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/li/cil/oc/common/container/Robot.scala b/src/main/java/li/cil/oc/common/container/Robot.scala index 8fbdd7f91..380cf771d 100644 --- a/src/main/java/li/cil/oc/common/container/Robot.scala +++ b/src/main/java/li/cil/oc/common/container/Robot.scala @@ -1,5 +1,6 @@ package li.cil.oc.common.container +import cpw.mods.fml.common.FMLCommonHandler import li.cil.oc.api import li.cil.oc.common.tileentity import li.cil.oc.server.{PacketSender => ServerPacketSender} @@ -25,9 +26,11 @@ class Robot(playerInventory: InventoryPlayer, robot: tileentity.Robot) extends P override def detectAndSendChanges() { super.detectAndSendChanges() - if (math.abs(robot.globalBuffer - lastSentBuffer) > 1) { - lastSentBuffer = robot.globalBuffer - ServerPacketSender.sendPowerState(robot) + if (FMLCommonHandler.instance.getEffectiveSide.isServer) { + if (math.abs(robot.globalBuffer - lastSentBuffer) > 1) { + lastSentBuffer = robot.globalBuffer + ServerPacketSender.sendPowerState(robot) + } } }