From 2dd8da26fcd0afa06e27ecc62e76d5ccbf8a65ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Mon, 6 Jan 2014 17:32:42 +0100 Subject: [PATCH] grabbing screen touch coordinates on the client side and sending them as a click to the server to avoid loss of accuracy (block activation events only have a resolution of 16x16 apparently). closes #57. again. --- li/cil/oc/common/tileentity/Screen.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/li/cil/oc/common/tileentity/Screen.scala b/li/cil/oc/common/tileentity/Screen.scala index 82561eee8..0256d3a01 100644 --- a/li/cil/oc/common/tileentity/Screen.scala +++ b/li/cil/oc/common/tileentity/Screen.scala @@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly} import li.cil.oc.Settings import li.cil.oc.api.network.{SidedEnvironment, Analyzable, Visibility} import li.cil.oc.client.renderer.MonospaceFontRenderer +import li.cil.oc.client.{PacketSender => ClientPacketSender} import li.cil.oc.server.{PacketSender => ServerPacketSender} import net.minecraft.client.Minecraft import net.minecraft.entity.Entity @@ -116,10 +117,9 @@ class Screen(var tier: Int) extends Buffer with SidedEnvironment with Rotatable (rx, ry) } - // Convert to absolute coordinates and send the (checked) signal. - if (!world.isRemote) { - val (bx, by) = (brx * bw, bry * bh) - origin.node.sendToReachable("computer.checked_signal", player, "touch", Int.box(bx.toInt + 1), Int.box(by.toInt + 1), player.getCommandSenderName) + // Convert to absolute coordinates and send the packet to the server. + if (world.isRemote) { + ClientPacketSender.sendMouseClick(this, (brx * bw).toInt + 1, (bry * bh).toInt + 1, drag = false) } true }