mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 03:05:30 -04:00
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.
This commit is contained in:
parent
3b59b53d5c
commit
2dd8da26fc
@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
|
|||||||
import li.cil.oc.Settings
|
import li.cil.oc.Settings
|
||||||
import li.cil.oc.api.network.{SidedEnvironment, Analyzable, Visibility}
|
import li.cil.oc.api.network.{SidedEnvironment, Analyzable, Visibility}
|
||||||
import li.cil.oc.client.renderer.MonospaceFontRenderer
|
import li.cil.oc.client.renderer.MonospaceFontRenderer
|
||||||
|
import li.cil.oc.client.{PacketSender => ClientPacketSender}
|
||||||
import li.cil.oc.server.{PacketSender => ServerPacketSender}
|
import li.cil.oc.server.{PacketSender => ServerPacketSender}
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
@ -116,10 +117,9 @@ class Screen(var tier: Int) extends Buffer with SidedEnvironment with Rotatable
|
|||||||
(rx, ry)
|
(rx, ry)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert to absolute coordinates and send the (checked) signal.
|
// Convert to absolute coordinates and send the packet to the server.
|
||||||
if (!world.isRemote) {
|
if (world.isRemote) {
|
||||||
val (bx, by) = (brx * bw, bry * bh)
|
ClientPacketSender.sendMouseClick(this, (brx * bw).toInt + 1, (bry * bh).toInt + 1, drag = false)
|
||||||
origin.node.sendToReachable("computer.checked_signal", player, "touch", Int.box(bx.toInt + 1), Int.box(by.toInt + 1), player.getCommandSenderName)
|
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user