Keyboard shortcuts in recipe selectors (alloy furnace & workbench)

This commit is contained in:
Emmanuel BENOîT 2016-07-21 11:19:30 +02:00
parent a95ca66528
commit e6cbf48ed8
3 changed files with 36 additions and 3 deletions

View file

@ -47,7 +47,6 @@ tech.base No Metal recycler / advanced furnace
tech.base No Workbench
Support for remaining recipe types BF
Allow clicking ingredients to get their recipe BF
Keyboard shortcuts BF
-------------------------------------------------------------------------------------------------------
tech.tools No Pan (for e.g. panning gold)
-> limit it per chunk

View file

@ -3,6 +3,8 @@ package mmm.tech.base.alloy_furnace;
import java.util.ArrayList;
import org.lwjgl.input.Keyboard;
import mmm.Mmm;
import mmm.core.CNetwork;
import mmm.materials.MAlloyRecipe;
@ -159,10 +161,27 @@ public class TBAFGui
@Override
public boolean onKeyTyped( final char typedChar , final int keyCode )
{
if ( this.tfSearch.textboxKeyTyped( typedChar , keyCode ) ) {
if ( this.tfSearch.isFocused( ) && keyCode == Keyboard.KEY_ESCAPE ) {
this.tfSearch.setFocused( false );
return true;
} else if ( this.tfSearch.textboxKeyTyped( typedChar , keyCode ) ) {
( (TBAFGui) this.parent ).handleFiltering( this.tfSearch.getText( ) );
return true;
} else if ( typedChar == 't' || typedChar == 'T' ) {
this.tfSearch.setFocused( true );
return true;
} else if ( keyCode == Keyboard.KEY_LEFT && this.bPrevious.enabled ) {
this.onActionPerformed( this.bPrevious );
return true;
} else if ( keyCode == Keyboard.KEY_RIGHT && this.bNext.enabled ) {
this.onActionPerformed( this.bNext );
return true;
}
return false;
}

View file

@ -5,6 +5,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.lwjgl.input.Keyboard;
import mmm.Mmm;
import mmm.core.CNetwork;
import mmm.core.api.recipes.I_CraftingRecipeWrapper;
@ -125,8 +127,21 @@ public class TBWBGui
protected void keyTyped( final char typedChar , final int keyCode )
throws IOException
{
if ( this.tfSearch.textboxKeyTyped( typedChar , keyCode ) ) {
if ( this.tfSearch.isFocused( ) && keyCode == Keyboard.KEY_ESCAPE ) {
this.tfSearch.setFocused( false );
} else if ( this.tfSearch.textboxKeyTyped( typedChar , keyCode ) ) {
this.handleFiltering( this.tfSearch.getText( ) );
} else if ( typedChar == 't' || typedChar == 'T' ) {
this.tfSearch.setFocused( true );
} else if ( keyCode == Keyboard.KEY_LEFT && this.bPrevious.enabled ) {
this.actionPerformed( this.bPrevious );
} else if ( keyCode == Keyboard.KEY_RIGHT && this.bNext.enabled ) {
this.actionPerformed( this.bNext );
} else {
super.keyTyped( typedChar , keyCode );
}