1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-15 04:30:29 +00:00

Merge pull request #1100 from Lemmmy/lemmmy/extendable-computer-screen

Make ComputerScreenBase methods extendable
This commit is contained in:
Jonathan Coates 2022-05-23 18:04:30 +01:00 committed by GitHub
commit 36635662f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,7 @@ public abstract class ComputerScreenBase<T extends ContainerComputerBase> extend
protected abstract WidgetTerminal createTerminal(); protected abstract WidgetTerminal createTerminal();
@Override @Override
protected final void init() protected void init()
{ {
super.init(); super.init();
minecraft.keyboardHandler.setSendRepeatsToGui( true ); minecraft.keyboardHandler.setSendRepeatsToGui( true );
@ -69,21 +69,21 @@ public abstract class ComputerScreenBase<T extends ContainerComputerBase> extend
} }
@Override @Override
public final void removed() public void removed()
{ {
super.removed(); super.removed();
minecraft.keyboardHandler.setSendRepeatsToGui( false ); minecraft.keyboardHandler.setSendRepeatsToGui( false );
} }
@Override @Override
public final void tick() public void tick()
{ {
super.tick(); super.tick();
terminal.update(); terminal.update();
} }
@Override @Override
public final boolean keyPressed( int key, int scancode, int modifiers ) public boolean keyPressed( int key, int scancode, int modifiers )
{ {
// Forward the tab key to the terminal, rather than moving between controls. // Forward the tab key to the terminal, rather than moving between controls.
if( key == GLFW.GLFW_KEY_TAB && getFocused() != null && getFocused() == terminal ) if( key == GLFW.GLFW_KEY_TAB && getFocused() != null && getFocused() == terminal )
@ -96,7 +96,7 @@ public abstract class ComputerScreenBase<T extends ContainerComputerBase> extend
@Override @Override
public final void render( @Nonnull MatrixStack stack, int mouseX, int mouseY, float partialTicks ) public void render( @Nonnull MatrixStack stack, int mouseX, int mouseY, float partialTicks )
{ {
renderBackground( stack ); renderBackground( stack );
super.render( stack, mouseX, mouseY, partialTicks ); super.render( stack, mouseX, mouseY, partialTicks );
@ -114,7 +114,7 @@ public abstract class ComputerScreenBase<T extends ContainerComputerBase> extend
} }
@Override @Override
public final boolean mouseDragged( double x, double y, int button, double deltaX, double deltaY ) public boolean mouseDragged( double x, double y, int button, double deltaX, double deltaY )
{ {
return (getFocused() != null && getFocused().mouseDragged( x, y, button, deltaX, deltaY )) return (getFocused() != null && getFocused().mouseDragged( x, y, button, deltaX, deltaY ))
|| super.mouseDragged( x, y, button, deltaX, deltaY ); || super.mouseDragged( x, y, button, deltaX, deltaY );