Workbench - Some progress on the GUI
This commit is contained in:
parent
149e2fd64a
commit
d99f7be107
5 changed files with 70 additions and 3 deletions
Binary file not shown.
|
@ -25,9 +25,9 @@ public class TBWBContainer
|
||||||
this.world = tileEntity.getWorld( );
|
this.world = tileEntity.getWorld( );
|
||||||
this.position = tileEntity.getPos( );
|
this.position = tileEntity.getPos( );
|
||||||
|
|
||||||
this.addPlayerInventory( Slot::new , playerInv , 28 , 112 );
|
this.addPlayerInventory( Slot::new , playerInv , 28 , 119 );
|
||||||
this.slotGroups.nextGroup( );
|
this.slotGroups.nextGroup( );
|
||||||
this.addGrid( Slot::new , tileEntity.storage , 8 , 13 );
|
this.addGrid( Slot::new , tileEntity.storage , 8 , 15 );
|
||||||
this.slotGroups.endGroups( );
|
this.slotGroups.endGroups( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
package mmm.tech.base.workbench;
|
package mmm.tech.base.workbench;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import mmm.Mmm;
|
import mmm.Mmm;
|
||||||
import mmm.utils.gui.A_UGContainerScreen;
|
import mmm.utils.gui.A_UGContainerScreen;
|
||||||
|
import mmm.utils.gui.UGArrowButton;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
@ -16,6 +22,10 @@ public class TBWBGui
|
||||||
extends A_UGContainerScreen< TBWBContainer >
|
extends A_UGContainerScreen< TBWBContainer >
|
||||||
{
|
{
|
||||||
private static final ResourceLocation BACKGROUND = new ResourceLocation( Mmm.ID , "textures/gui/workbench.png" );
|
private static final ResourceLocation BACKGROUND = new ResourceLocation( Mmm.ID , "textures/gui/workbench.png" );
|
||||||
|
private GuiTextField tfSearch;
|
||||||
|
private UGArrowButton bPrevious;
|
||||||
|
private UGArrowButton bNext;
|
||||||
|
private GuiButton bSetDefault;
|
||||||
|
|
||||||
|
|
||||||
public TBWBGui( final InventoryPlayer inventoryPlayer , final TBWBTileEntity tileEntity )
|
public TBWBGui( final InventoryPlayer inventoryPlayer , final TBWBTileEntity tileEntity )
|
||||||
|
@ -23,7 +33,33 @@ public class TBWBGui
|
||||||
super( new TBWBContainer( inventoryPlayer , tileEntity ) );
|
super( new TBWBContainer( inventoryPlayer , tileEntity ) );
|
||||||
this.container.slotGroups.showAll( );
|
this.container.slotGroups.showAll( );
|
||||||
this.xSize = 216;
|
this.xSize = 216;
|
||||||
this.ySize = 194;
|
this.ySize = 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui( )
|
||||||
|
{
|
||||||
|
super.initGui( );
|
||||||
|
|
||||||
|
final int x = ( this.width - this.xSize ) / 2;
|
||||||
|
final int y = ( this.height - this.ySize ) / 2;
|
||||||
|
|
||||||
|
this.tfSearch = new GuiTextField( 0 , this.getFontRenderer( ) , 71 + x , 7 + y , 138 , 20 );
|
||||||
|
this.tfSearch.setTextColor( 0xffffff );
|
||||||
|
this.tfSearch.setDisabledTextColour( 0x7f7f7f );
|
||||||
|
this.tfSearch.setEnableBackgroundDrawing( true );
|
||||||
|
this.tfSearch.setMaxStringLength( 30 );
|
||||||
|
this.tfSearch.setVisible( true );
|
||||||
|
|
||||||
|
this.bPrevious = new UGArrowButton( 1 , 71 + x , 50 + y , false );
|
||||||
|
this.bNext = new UGArrowButton( 2 , 199 + x , 50 + y , true );
|
||||||
|
this.bSetDefault = new GuiButton( 3 , 71 + x , 89 + y , 138 , 20 ,
|
||||||
|
I18n.format( "container.mmm.workbench.default" ) );
|
||||||
|
|
||||||
|
this.buttonList.add( this.bPrevious );
|
||||||
|
this.buttonList.add( this.bNext );
|
||||||
|
this.buttonList.add( this.bSetDefault );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,6 +71,36 @@ public class TBWBGui
|
||||||
GlStateManager.disableLighting( );
|
GlStateManager.disableLighting( );
|
||||||
this.mc.getTextureManager( ).bindTexture( TBWBGui.BACKGROUND );
|
this.mc.getTextureManager( ).bindTexture( TBWBGui.BACKGROUND );
|
||||||
this.drawTexturedModalRect( this.guiLeft , this.guiTop , 0 , 0 , this.xSize , this.ySize );
|
this.drawTexturedModalRect( this.guiLeft , this.guiTop , 0 , 0 , this.xSize , this.ySize );
|
||||||
|
|
||||||
|
GlStateManager.disableBlend( );
|
||||||
|
this.tfSearch.drawTextBox( );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked( final int mouseX , final int mouseY , final int mouseButton )
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
super.mouseClicked( mouseX , mouseY , mouseButton );
|
||||||
|
this.tfSearch.mouseClicked( mouseX , mouseY , mouseButton );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped( final char typedChar , final int keyCode )
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
if ( !this.tfSearch.textboxKeyTyped( typedChar , keyCode ) ) {
|
||||||
|
super.keyTyped( typedChar , keyCode );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed( final GuiButton button )
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ tile.mmm.materials.trap.swamp_pit.name=Silty Quicksand
|
||||||
|
|
||||||
|
|
||||||
tile.mmm.tech.base.workbench.name=Workbench
|
tile.mmm.tech.base.workbench.name=Workbench
|
||||||
|
container.mmm.workbench.default=Set Default Recipe
|
||||||
|
|
||||||
tile.mmm.tech.base.alloy_furnace.inactive.name=Alloy Furnace
|
tile.mmm.tech.base.alloy_furnace.inactive.name=Alloy Furnace
|
||||||
container.mmm.alloy_furnace.contents=Furnace Contents
|
container.mmm.alloy_furnace.contents=Furnace Contents
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Reference in a new issue