From d99f7be107f647689aac26049938ecbe5939d85a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Wed, 13 Jul 2016 16:39:33 +0200 Subject: [PATCH] Workbench - Some progress on the GUI --- graphics/workbench-gui.xcf | Bin 30892 -> 31221 bytes .../tech/base/workbench/TBWBContainer.java | 4 +- src/java/mmm/tech/base/workbench/TBWBGui.java | 68 +++++++++++++++++- src/resources/assets/mmm/lang/en_US.lang | 1 + .../assets/mmm/textures/gui/workbench.png | Bin 1137 -> 1160 bytes 5 files changed, 70 insertions(+), 3 deletions(-) diff --git a/graphics/workbench-gui.xcf b/graphics/workbench-gui.xcf index ac2b8f274999d99825c94d49e10420ccb6e1142e..a3ada5c29c2135d8dbdffc0fc90b700b13c78998 100644 GIT binary patch delta 461 zcmZ4Uk@4$i#tC+e3LEXc85#2@cQa06)Sdh=OnkE`QyUYb5tw}daGa!xvVipDlp#uyIs>wh$2tdV!t}rkt0Oc4M zHXDea-~bXSESrDGPiCE55|+U#4HPc}TP3c>V#ro`mw}=3 z!~cH_|84&>GT8nHYW`o(dw>Bbc&whG0c;RXHj@L%YDJDQPHv5po-9?u#VQIkU2Ae< foIFlmLZYma*nbTMQJ_7qKq1!v#UQo=6f*z-g(`nv delta 439 zcmezRnQ_fW#tC+eLL2S985z?jcQa06)S3J+OnkE`QyUYbA((lYWj!OK9GE$at&n?i zNmvFeI|Bm)4@k(81IU5`p#@Ne8IXp^aAV0T28N;uK)ehnq5#A$KpY3e6`OOzYsDwq zSFmqhn6#4-g<)9Ff8hT=hX1zzfsAAJp(vyP0~XQE6N@SsCwo_NZJrWm$2fUGoEZjZ zv0)BlJrjcs$TS9YnvucwKTr&4asva{J`}Q^p@D#mDA3eb49KL|e+>pvpsrP*&})F= I$uBB-0fwT5r2qf` diff --git a/src/java/mmm/tech/base/workbench/TBWBContainer.java b/src/java/mmm/tech/base/workbench/TBWBContainer.java index 86e5554..fb4ff6a 100644 --- a/src/java/mmm/tech/base/workbench/TBWBContainer.java +++ b/src/java/mmm/tech/base/workbench/TBWBContainer.java @@ -25,9 +25,9 @@ public class TBWBContainer this.world = tileEntity.getWorld( ); this.position = tileEntity.getPos( ); - this.addPlayerInventory( Slot::new , playerInv , 28 , 112 ); + this.addPlayerInventory( Slot::new , playerInv , 28 , 119 ); this.slotGroups.nextGroup( ); - this.addGrid( Slot::new , tileEntity.storage , 8 , 13 ); + this.addGrid( Slot::new , tileEntity.storage , 8 , 15 ); this.slotGroups.endGroups( ); } diff --git a/src/java/mmm/tech/base/workbench/TBWBGui.java b/src/java/mmm/tech/base/workbench/TBWBGui.java index ac5b91d..3f2856b 100644 --- a/src/java/mmm/tech/base/workbench/TBWBGui.java +++ b/src/java/mmm/tech/base/workbench/TBWBGui.java @@ -1,9 +1,15 @@ package mmm.tech.base.workbench; +import java.io.IOException; + import mmm.Mmm; 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.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; @@ -16,6 +22,10 @@ public class TBWBGui extends A_UGContainerScreen< TBWBContainer > { 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 ) @@ -23,7 +33,33 @@ public class TBWBGui super( new TBWBContainer( inventoryPlayer , tileEntity ) ); this.container.slotGroups.showAll( ); 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( ); this.mc.getTextureManager( ).bindTexture( TBWBGui.BACKGROUND ); 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 } } diff --git a/src/resources/assets/mmm/lang/en_US.lang b/src/resources/assets/mmm/lang/en_US.lang index 5186c70..010e5f2 100644 --- a/src/resources/assets/mmm/lang/en_US.lang +++ b/src/resources/assets/mmm/lang/en_US.lang @@ -81,6 +81,7 @@ tile.mmm.materials.trap.swamp_pit.name=Silty Quicksand tile.mmm.tech.base.workbench.name=Workbench +container.mmm.workbench.default=Set Default Recipe tile.mmm.tech.base.alloy_furnace.inactive.name=Alloy Furnace container.mmm.alloy_furnace.contents=Furnace Contents diff --git a/src/resources/assets/mmm/textures/gui/workbench.png b/src/resources/assets/mmm/textures/gui/workbench.png index ae128ced811345354c93d357a80395393ad8e3ad..f55f6570b7056e22151465d0dec1dc06645e75e4 100644 GIT binary patch delta 791 zcmey!(ZM+(q@GVfzT?EkO$-byqMj~}Ar-gY-npB**g>Qr&?of7mPGNUCq@%Aj%;bv z)b3P{{23@Gq{nA`#`03_&Gw6@n(}$I@9+BcA*m-abyJ{y-aqrHhH7?}t_$k!{5fEi zw>{cSaK--r2W`$Dn{j~WaKPO2&vldn>i7R_EV^RHB*5Unz`&@^z`_7w0U0+c8FsDX zK5ycCaxU|qPtpfomT;YYTIBgj=792KK1P|z4a_VW4(k{z{?yqSY0mqcBerrwH$%_k z2vc9-S^M5kwtj9OvE-1R9AnIh2eOj|7^Uj#Hy&Fr`S(^J!-q|rhC6?l81m{E51j31c<{`fq2RMJ!;YVV4Lp&$ z5aZ*HDT$T|GKd$wiEeP!O8L+6z=`cWgTm`_t$T$W3^RBAUk?l-fBDG`Ofs?>6I`|4 zC^6_gNxk;#YgE?rfCz>hmZn4Uj5#b!?~kK&bBpwsmK7`vj2{Fi8#0Ll!;nM$!^4l& zZ%$Yox4c+|;mW|outXFh8gP&?#?fBWI;wrpoh69OEC&e=4F(Hvw>pbAJo@3Xv}Iq9l*o@0-mmZ JF6*2UngF`Vqfp02@DL(|2$nBLn>~)z1x_3%R!_eQN~bo%|WGUHx4(?Ff~XH z>`4i9OTDwM*T2oKFqz%{n(f5G&TqYO`E$%p6b735&fuuo`9pDi zqQs#)f#&y_3wFlLarC%QdiQVg{qINbbJqO*+u1Gu>eEw!1_lO8CI$`$1qL9CiDAvz zZ#VO|<<9=Y%GZAQS&5bC)^m0H%bz_AWmv|ocJyP#p7>;+5w9?n$zIc3YaJHm}VK}n*FGyH10qSToz^KLLt z{>LO<@4(P-XB!{m($gPboeIyY-MW}T!0FX$$@rCDulC6?9#B4T{;H{<#=rU3RaEbB zHFP?>FT4|RR<7Zs+5F11*w2O5^Uo(G@i)xs6?9+_U}Rx{Q3;ZDLKBkoqW)Vy;A03Z z6kutH+R6NZ}*?HaYW}9VcZ2A8i-~X2M9^Jz{LvMzN+U*A0$rG6+ zCNE&-bget>OHy8lMh{j4)q8?Sx5Rv^!H zpoA%C%8#(*Yn@yB=2v{>VBnbS$RejLaA47AhHJmT;(Yww`%GtaI$YCCoV!z<$+arm zK)7*D@Lel4rkl(RETDj&tiZ&g&cMRJall34b;x!;el@1Z<-1CKSbklQ1=%p8B6;o= zAa@fx#C!_@VBlX{nI|hJHkX6Nw8KR3gfhbopkWLvPA!_2ibN&vo;P(pL%7vbh;30a_o~UGjc730yban-4O_)78&qol`;+ E0AoU45&!@I