diff --git a/src/main/scala/li/cil/oc/common/block/Screen.scala b/src/main/scala/li/cil/oc/common/block/Screen.scala index a05222380..ae1c363ae 100644 --- a/src/main/scala/li/cil/oc/common/block/Screen.scala +++ b/src/main/scala/li/cil/oc/common/block/Screen.scala @@ -307,22 +307,20 @@ abstract class Screen(val parent: SimpleDelegator) extends RedstoneAware with Si override def rightClick(world: World, x: Int, y: Int, z: Int, player: EntityPlayer, side: ForgeDirection, hitX: Float, hitY: Float, hitZ: Float) = - if (!player.isSneaking && !BuildCraft.holdsApplicableWrench(player, x, y, z)) { - world.getBlockTileEntity(x, y, z) match { - case screen: tileentity.Screen if screen.hasKeyboard => - // Yep, this GUI is actually purely client side. We could skip this - // if, but it is clearer this way (to trigger it from the server we - // would have to give screens a "container", which we do not want). - if (world.isRemote) { - player.openGui(OpenComputers, GuiType.Screen.id, world, x, y, z) - } - true - case screen: tileentity.Screen if screen.tier > 0 && side == screen.facing => - screen.click(player, hitX, hitY, hitZ) - case _ => false - } + if (BuildCraft.holdsApplicableWrench(player, x, y, z)) false + else world.getBlockTileEntity(x, y, z) match { + case screen: tileentity.Screen if screen.hasKeyboard && !player.isSneaking => + // Yep, this GUI is actually purely client side. We could skip this + // if, but it is clearer this way (to trigger it from the server we + // would have to give screens a "container", which we do not want). + if (world.isRemote) { + player.openGui(OpenComputers, GuiType.Screen.id, world, x, y, z) + } + true + case screen: tileentity.Screen if screen.tier > 0 && side == screen.facing => + screen.click(player, hitX, hitY, hitZ) + case _ => false } - else false override def walk(world: World, x: Int, y: Int, z: Int, entity: Entity) = if (!world.isRemote) world.getBlockTileEntity(x, y, z) match { diff --git a/src/main/scala/li/cil/oc/common/tileentity/Screen.scala b/src/main/scala/li/cil/oc/common/tileentity/Screen.scala index f0bac8f97..5f99bbbf2 100644 --- a/src/main/scala/li/cil/oc/common/tileentity/Screen.scala +++ b/src/main/scala/li/cil/oc/common/tileentity/Screen.scala @@ -93,9 +93,9 @@ class Screen(var tier: Int) extends traits.TextBuffer with SidedEnvironment with val (rx, ry) = ((ax - border) / iw, (ay - border) / ih) // Make it a relative position in the displayed buffer. - val bw = buffer.getWidth - val bh = buffer.getHeight - val (bpw, bph) = (buffer.renderWidth / iw.toDouble, buffer.renderHeight / ih.toDouble) + val bw = origin.buffer.getWidth + val bh = origin.buffer.getHeight + val (bpw, bph) = (origin.buffer.renderWidth / iw.toDouble, origin.buffer.renderHeight / ih.toDouble) val (brx, bry) = if (bpw > bph) { val rh = bph.toDouble / bpw.toDouble val bry = (ry - (1 - rh) * 0.5) / rh @@ -118,7 +118,7 @@ class Screen(var tier: Int) extends traits.TextBuffer with SidedEnvironment with // Convert to absolute coordinates and send the packet to the server. if (world.isRemote) { - buffer.mouseDown((brx * bw).toInt + 1, (bry * bh).toInt + 1, 0, null) + origin.buffer.mouseDown((brx * bw).toInt + 1, (bry * bh).toInt + 1, 0, null) } true }