mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-02-15 18:40:05 +00:00
Add back the previous widget methods for back compat
Previously introduced in f765b6a487e6f6ec8ba2e978b0a2ff98faf78828. Fixes #87
This commit is contained in:
parent
05a97a4f12
commit
70cb8ae16c
@ -95,7 +95,7 @@ public class GuiComputer extends GuiContainer
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_terminal.keyTyped( c, k ) ) keyHandled = true;
|
||||
if( m_terminal.onKeyTyped( c, k ) ) keyHandled = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ public class GuiComputer extends GuiContainer
|
||||
public void handleKeyboardInput() throws IOException
|
||||
{
|
||||
super.handleKeyboardInput();
|
||||
if( m_terminal.handleKeyboardInput() ) keyHandled = true;
|
||||
if( m_terminal.onKeyboardInput() ) keyHandled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -150,7 +150,7 @@ public class GuiComputer extends GuiContainer
|
||||
|
||||
// Draw terminal
|
||||
m_terminal.draw( this.mc, startX, startY, mouseX, mouseY );
|
||||
|
||||
|
||||
// Draw a border around the terminal
|
||||
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
switch( m_family )
|
||||
|
@ -28,7 +28,7 @@ public class GuiTurtle extends GuiContainer
|
||||
{
|
||||
private static final ResourceLocation background = new ResourceLocation( "computercraft", "textures/gui/turtle.png" );
|
||||
private static final ResourceLocation backgroundAdvanced = new ResourceLocation( "computercraft", "textures/gui/turtle_advanced.png" );
|
||||
|
||||
|
||||
protected World m_world;
|
||||
protected ContainerTurtle m_container;
|
||||
|
||||
@ -36,7 +36,7 @@ public class GuiTurtle extends GuiContainer
|
||||
protected final ITurtleAccess m_turtle;
|
||||
protected final IComputer m_computer;
|
||||
protected WidgetTerminal m_terminalGui;
|
||||
|
||||
|
||||
public GuiTurtle( World world, InventoryPlayer inventoryplayer, TileTurtle turtle )
|
||||
{
|
||||
this( world, turtle, new ContainerTurtle( inventoryplayer, turtle.getAccess() ) );
|
||||
@ -51,7 +51,7 @@ public class GuiTurtle extends GuiContainer
|
||||
m_family = turtle.getFamily();
|
||||
m_turtle = turtle.getAccess();
|
||||
m_computer = turtle.createComputer();
|
||||
|
||||
|
||||
xSize = 254;
|
||||
ySize = 217;
|
||||
}
|
||||
@ -95,17 +95,17 @@ public class GuiTurtle extends GuiContainer
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_terminalGui.keyTyped( c, k ) ) keyHandled = true;
|
||||
if( m_terminalGui.onKeyTyped( c, k ) ) keyHandled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) throws IOException
|
||||
{
|
||||
super.mouseClicked( x, y, button );
|
||||
m_terminalGui.mouseClicked( x, y, button );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() throws IOException
|
||||
{
|
||||
@ -119,14 +119,14 @@ public class GuiTurtle extends GuiContainer
|
||||
public void handleKeyboardInput() throws IOException
|
||||
{
|
||||
super.handleKeyboardInput();
|
||||
if( m_terminalGui.handleKeyboardInput() ) keyHandled = true;
|
||||
if( m_terminalGui.onKeyboardInput() ) keyHandled = true;
|
||||
}
|
||||
|
||||
protected void drawSelectionSlot( boolean advanced )
|
||||
{
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
|
||||
|
||||
// Draw selection slot
|
||||
int slot = m_container.getSelectedSlot();
|
||||
if( slot >= 0 )
|
||||
@ -145,14 +145,14 @@ public class GuiTurtle extends GuiContainer
|
||||
// Draw term
|
||||
boolean advanced = (m_family == ComputerFamily.Advanced);
|
||||
m_terminalGui.draw( Minecraft.getMinecraft(), 0, 0, mouseX, mouseY );
|
||||
|
||||
|
||||
// Draw border/inventory
|
||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
this.mc.getTextureManager().bindTexture( advanced ? backgroundAdvanced : background );
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
|
||||
drawSelectionSlot( advanced );
|
||||
}
|
||||
|
||||
|
@ -7,16 +7,7 @@
|
||||
package dan200.computercraft.client.gui.widgets;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public abstract class Widget extends Gui
|
||||
{
|
||||
@ -65,17 +56,29 @@ public abstract class Widget extends Gui
|
||||
{
|
||||
}
|
||||
|
||||
public boolean handleKeyboardInput()
|
||||
public boolean onKeyboardInput()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void handleKeyboardInput()
|
||||
{
|
||||
onKeyboardInput();
|
||||
}
|
||||
|
||||
public void mouseClicked( int mouseX, int mouseY, int mouseButton )
|
||||
{
|
||||
}
|
||||
|
||||
public boolean keyTyped( char c, int k )
|
||||
public boolean onKeyTyped( char c, int k )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void keyTyped( char c, int k )
|
||||
{
|
||||
onKeyTyped( c, k );
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class WidgetTerminal extends Widget
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped( char ch, int key )
|
||||
public boolean onKeyTyped( char ch, int key )
|
||||
{
|
||||
if( m_focus )
|
||||
{
|
||||
@ -161,7 +161,7 @@ public class WidgetTerminal extends Widget
|
||||
return handled;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ public class WidgetTerminal extends Widget
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyboardInput()
|
||||
public boolean onKeyboardInput()
|
||||
{
|
||||
boolean handled = false;
|
||||
for( int i = m_keysDown.size() - 1; i >= 0; --i )
|
||||
@ -296,10 +296,10 @@ public class WidgetTerminal extends Widget
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
{
|
||||
// Handle special keys
|
||||
if( m_focus && (Keyboard.isKeyDown( 29 ) || Keyboard.isKeyDown( 157 )) )
|
||||
{
|
||||
{
|
||||
// Ctrl+T for terminate
|
||||
if( Keyboard.isKeyDown( 20 ) )
|
||||
{
|
||||
@ -316,7 +316,7 @@ public class WidgetTerminal extends Widget
|
||||
{
|
||||
m_terminateTimer = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
// Ctrl+R for reboot
|
||||
if( Keyboard.isKeyDown(19) )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user