mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 11:15:12 -04:00
Shift-rightclicking screen with keyboard will trigger a touch signal instead of doing nothing.
This commit is contained in:
parent
0c6584411f
commit
fae12c980f
@ -307,9 +307,9 @@ abstract class Screen(val parent: SimpleDelegator) extends RedstoneAware with Si
|
|||||||
|
|
||||||
override def rightClick(world: World, x: Int, y: Int, z: Int, player: EntityPlayer,
|
override def rightClick(world: World, x: Int, y: Int, z: Int, player: EntityPlayer,
|
||||||
side: ForgeDirection, hitX: Float, hitY: Float, hitZ: Float) =
|
side: ForgeDirection, hitX: Float, hitY: Float, hitZ: Float) =
|
||||||
if (!player.isSneaking && !BuildCraft.holdsApplicableWrench(player, x, y, z)) {
|
if (BuildCraft.holdsApplicableWrench(player, x, y, z)) false
|
||||||
world.getBlockTileEntity(x, y, z) match {
|
else world.getBlockTileEntity(x, y, z) match {
|
||||||
case screen: tileentity.Screen if screen.hasKeyboard =>
|
case screen: tileentity.Screen if screen.hasKeyboard && !player.isSneaking =>
|
||||||
// Yep, this GUI is actually purely client side. We could skip this
|
// 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
|
// 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).
|
// would have to give screens a "container", which we do not want).
|
||||||
@ -321,8 +321,6 @@ abstract class Screen(val parent: SimpleDelegator) extends RedstoneAware with Si
|
|||||||
screen.click(player, hitX, hitY, hitZ)
|
screen.click(player, hitX, hitY, hitZ)
|
||||||
case _ => false
|
case _ => false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else false
|
|
||||||
|
|
||||||
override def walk(world: World, x: Int, y: Int, z: Int, entity: Entity) =
|
override def walk(world: World, x: Int, y: Int, z: Int, entity: Entity) =
|
||||||
if (!world.isRemote) world.getBlockTileEntity(x, y, z) match {
|
if (!world.isRemote) world.getBlockTileEntity(x, y, z) match {
|
||||||
|
@ -93,9 +93,9 @@ class Screen(var tier: Int) extends traits.TextBuffer with SidedEnvironment with
|
|||||||
val (rx, ry) = ((ax - border) / iw, (ay - border) / ih)
|
val (rx, ry) = ((ax - border) / iw, (ay - border) / ih)
|
||||||
|
|
||||||
// Make it a relative position in the displayed buffer.
|
// Make it a relative position in the displayed buffer.
|
||||||
val bw = buffer.getWidth
|
val bw = origin.buffer.getWidth
|
||||||
val bh = buffer.getHeight
|
val bh = origin.buffer.getHeight
|
||||||
val (bpw, bph) = (buffer.renderWidth / iw.toDouble, buffer.renderHeight / ih.toDouble)
|
val (bpw, bph) = (origin.buffer.renderWidth / iw.toDouble, origin.buffer.renderHeight / ih.toDouble)
|
||||||
val (brx, bry) = if (bpw > bph) {
|
val (brx, bry) = if (bpw > bph) {
|
||||||
val rh = bph.toDouble / bpw.toDouble
|
val rh = bph.toDouble / bpw.toDouble
|
||||||
val bry = (ry - (1 - rh) * 0.5) / rh
|
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.
|
// Convert to absolute coordinates and send the packet to the server.
|
||||||
if (world.isRemote) {
|
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
|
true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user