mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-03-22 11:26:58 +00:00
Update GUI code to be compatible with 1.14.4
Not quite sure when this changed, but I'm fairly sure isMouseOver wasn't a thing when I wrote this. Or I'm a plonker. Both are possible. Also fixes mouse dragging not being handled in turtles. Fixes #299
This commit is contained in:
parent
4243f30308
commit
ff5ba5c131
@ -176,11 +176,4 @@ public final class GuiComputer<T extends ContainerComputerBase> extends Containe
|
||||
return (getFocused() != null && getFocused().mouseDragged( x, y, button, deltaX, deltaY ))
|
||||
|| super.mouseDragged( x, y, button, deltaX, deltaY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased( double x, double y, int button )
|
||||
{
|
||||
return (getFocused() != null && getFocused().mouseReleased( x, y, button ))
|
||||
|| super.mouseReleased( x, y, button );
|
||||
}
|
||||
}
|
||||
|
@ -129,4 +129,11 @@ public class GuiTurtle extends ContainerScreen<ContainerTurtle>
|
||||
super.render( mouseX, mouseY, partialTicks );
|
||||
renderHoveredToolTip( mouseX, mouseY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseDragged( double x, double y, int button, double deltaX, double deltaY )
|
||||
{
|
||||
return (getFocused() != null && getFocused().mouseDragged( x, y, button, deltaX, deltaY ))
|
||||
|| super.mouseDragged( x, y, button, deltaX, deltaY );
|
||||
}
|
||||
}
|
||||
|
@ -241,11 +241,12 @@ public class WidgetTerminal implements IGuiEventListener
|
||||
charX = Math.min( Math.max( charX, 0 ), term.getWidth() - 1 );
|
||||
charY = Math.min( Math.max( charY, 0 ), term.getHeight() - 1 );
|
||||
|
||||
computer.mouseDrag( button + 1, charX + 1, charY + 1 );
|
||||
|
||||
lastMouseX = charX;
|
||||
lastMouseY = charY;
|
||||
lastMouseButton = button;
|
||||
if( button == lastMouseButton && (charX != lastMouseX || charY != lastMouseY) )
|
||||
{
|
||||
computer.mouseDrag( button + 1, charX + 1, charY + 1 );
|
||||
lastMouseX = charX;
|
||||
lastMouseY = charY;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -427,4 +428,10 @@ public class WidgetTerminal implements IGuiEventListener
|
||||
ClientComputer computer = this.computer.get();
|
||||
if( computer != null ) computer.queueEvent( event, args );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMouseOver( double x, double y )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -95,4 +95,11 @@ public class WidgetWrapper implements IGuiEventListener
|
||||
{
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMouseOver( double x, double y )
|
||||
{
|
||||
double dx = x - this.x, dy = y - this.y;
|
||||
return dx >= 0 && dx < width && dy >= 0 && dy < height;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user