mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-29 14:13:13 +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
|
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
|
public void handleKeyboardInput() throws IOException
|
||||||
{
|
{
|
||||||
super.handleKeyboardInput();
|
super.handleKeyboardInput();
|
||||||
if( m_terminal.handleKeyboardInput() ) keyHandled = true;
|
if( m_terminal.onKeyboardInput() ) keyHandled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -150,7 +150,7 @@ public class GuiComputer extends GuiContainer
|
|||||||
|
|
||||||
// Draw terminal
|
// Draw terminal
|
||||||
m_terminal.draw( this.mc, startX, startY, mouseX, mouseY );
|
m_terminal.draw( this.mc, startX, startY, mouseX, mouseY );
|
||||||
|
|
||||||
// Draw a border around the terminal
|
// Draw a border around the terminal
|
||||||
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
|
GlStateManager.color( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||||
switch( m_family )
|
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 background = new ResourceLocation( "computercraft", "textures/gui/turtle.png" );
|
||||||
private static final ResourceLocation backgroundAdvanced = new ResourceLocation( "computercraft", "textures/gui/turtle_advanced.png" );
|
private static final ResourceLocation backgroundAdvanced = new ResourceLocation( "computercraft", "textures/gui/turtle_advanced.png" );
|
||||||
|
|
||||||
protected World m_world;
|
protected World m_world;
|
||||||
protected ContainerTurtle m_container;
|
protected ContainerTurtle m_container;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ public class GuiTurtle extends GuiContainer
|
|||||||
protected final ITurtleAccess m_turtle;
|
protected final ITurtleAccess m_turtle;
|
||||||
protected final IComputer m_computer;
|
protected final IComputer m_computer;
|
||||||
protected WidgetTerminal m_terminalGui;
|
protected WidgetTerminal m_terminalGui;
|
||||||
|
|
||||||
public GuiTurtle( World world, InventoryPlayer inventoryplayer, TileTurtle turtle )
|
public GuiTurtle( World world, InventoryPlayer inventoryplayer, TileTurtle turtle )
|
||||||
{
|
{
|
||||||
this( world, turtle, new ContainerTurtle( inventoryplayer, turtle.getAccess() ) );
|
this( world, turtle, new ContainerTurtle( inventoryplayer, turtle.getAccess() ) );
|
||||||
@ -51,7 +51,7 @@ public class GuiTurtle extends GuiContainer
|
|||||||
m_family = turtle.getFamily();
|
m_family = turtle.getFamily();
|
||||||
m_turtle = turtle.getAccess();
|
m_turtle = turtle.getAccess();
|
||||||
m_computer = turtle.createComputer();
|
m_computer = turtle.createComputer();
|
||||||
|
|
||||||
xSize = 254;
|
xSize = 254;
|
||||||
ySize = 217;
|
ySize = 217;
|
||||||
}
|
}
|
||||||
@ -95,17 +95,17 @@ public class GuiTurtle extends GuiContainer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( m_terminalGui.keyTyped( c, k ) ) keyHandled = true;
|
if( m_terminalGui.onKeyTyped( c, k ) ) keyHandled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void mouseClicked(int x, int y, int button) throws IOException
|
protected void mouseClicked(int x, int y, int button) throws IOException
|
||||||
{
|
{
|
||||||
super.mouseClicked( x, y, button );
|
super.mouseClicked( x, y, button );
|
||||||
m_terminalGui.mouseClicked( x, y, button );
|
m_terminalGui.mouseClicked( x, y, button );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMouseInput() throws IOException
|
public void handleMouseInput() throws IOException
|
||||||
{
|
{
|
||||||
@ -119,14 +119,14 @@ public class GuiTurtle extends GuiContainer
|
|||||||
public void handleKeyboardInput() throws IOException
|
public void handleKeyboardInput() throws IOException
|
||||||
{
|
{
|
||||||
super.handleKeyboardInput();
|
super.handleKeyboardInput();
|
||||||
if( m_terminalGui.handleKeyboardInput() ) keyHandled = true;
|
if( m_terminalGui.onKeyboardInput() ) keyHandled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawSelectionSlot( boolean advanced )
|
protected void drawSelectionSlot( boolean advanced )
|
||||||
{
|
{
|
||||||
int x = (width - xSize) / 2;
|
int x = (width - xSize) / 2;
|
||||||
int y = (height - ySize) / 2;
|
int y = (height - ySize) / 2;
|
||||||
|
|
||||||
// Draw selection slot
|
// Draw selection slot
|
||||||
int slot = m_container.getSelectedSlot();
|
int slot = m_container.getSelectedSlot();
|
||||||
if( slot >= 0 )
|
if( slot >= 0 )
|
||||||
@ -145,14 +145,14 @@ public class GuiTurtle extends GuiContainer
|
|||||||
// Draw term
|
// Draw term
|
||||||
boolean advanced = (m_family == ComputerFamily.Advanced);
|
boolean advanced = (m_family == ComputerFamily.Advanced);
|
||||||
m_terminalGui.draw( Minecraft.getMinecraft(), 0, 0, mouseX, mouseY );
|
m_terminalGui.draw( Minecraft.getMinecraft(), 0, 0, mouseX, mouseY );
|
||||||
|
|
||||||
// Draw border/inventory
|
// Draw border/inventory
|
||||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||||
this.mc.getTextureManager().bindTexture( advanced ? backgroundAdvanced : background );
|
this.mc.getTextureManager().bindTexture( advanced ? backgroundAdvanced : background );
|
||||||
int x = (width - xSize) / 2;
|
int x = (width - xSize) / 2;
|
||||||
int y = (height - ySize) / 2;
|
int y = (height - ySize) / 2;
|
||||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||||
|
|
||||||
drawSelectionSlot( advanced );
|
drawSelectionSlot( advanced );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,16 +7,7 @@
|
|||||||
package dan200.computercraft.client.gui.widgets;
|
package dan200.computercraft.client.gui.widgets;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
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.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
|
public abstract class Widget extends Gui
|
||||||
{
|
{
|
||||||
@ -65,17 +56,29 @@ public abstract class Widget extends Gui
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleKeyboardInput()
|
public boolean onKeyboardInput()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void handleKeyboardInput()
|
||||||
|
{
|
||||||
|
onKeyboardInput();
|
||||||
|
}
|
||||||
|
|
||||||
public void mouseClicked( int mouseX, int mouseY, int mouseButton )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public void keyTyped( char c, int k )
|
||||||
|
{
|
||||||
|
onKeyTyped( c, k );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public class WidgetTerminal extends Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyTyped( char ch, int key )
|
public boolean onKeyTyped( char ch, int key )
|
||||||
{
|
{
|
||||||
if( m_focus )
|
if( m_focus )
|
||||||
{
|
{
|
||||||
@ -161,7 +161,7 @@ public class WidgetTerminal extends Widget
|
|||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ public class WidgetTerminal extends Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleKeyboardInput()
|
public boolean onKeyboardInput()
|
||||||
{
|
{
|
||||||
boolean handled = false;
|
boolean handled = false;
|
||||||
for( int i = m_keysDown.size() - 1; i >= 0; --i )
|
for( int i = m_keysDown.size() - 1; i >= 0; --i )
|
||||||
@ -296,10 +296,10 @@ public class WidgetTerminal extends Widget
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
// Handle special keys
|
// Handle special keys
|
||||||
if( m_focus && (Keyboard.isKeyDown( 29 ) || Keyboard.isKeyDown( 157 )) )
|
if( m_focus && (Keyboard.isKeyDown( 29 ) || Keyboard.isKeyDown( 157 )) )
|
||||||
{
|
{
|
||||||
// Ctrl+T for terminate
|
// Ctrl+T for terminate
|
||||||
if( Keyboard.isKeyDown( 20 ) )
|
if( Keyboard.isKeyDown( 20 ) )
|
||||||
{
|
{
|
||||||
@ -316,7 +316,7 @@ public class WidgetTerminal extends Widget
|
|||||||
{
|
{
|
||||||
m_terminateTimer = 0.0f;
|
m_terminateTimer = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ctrl+R for reboot
|
// Ctrl+R for reboot
|
||||||
if( Keyboard.isKeyDown(19) )
|
if( Keyboard.isKeyDown(19) )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user