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,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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user