From ee736975b26593d57a9c657506c1b1f34d8f2576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 25 Jun 2016 22:55:15 +0200 Subject: [PATCH] Alloy furnace - Config tab Doesn't work yet. Also added tooltips on tabs. --- graphics/alloy-furnace-gui-1.xcf | Bin 43441 -> 44111 bytes src/java/mmm/tech/base/TBAlloyFurnaceGui.java | 55 ++++++++++++------ src/resources/assets/mmm/lang/en_US.lang | 5 +- .../mmm/textures/gui/alloy_furnace_1.png | Bin 2172 -> 2397 bytes 4 files changed, 41 insertions(+), 19 deletions(-) diff --git a/graphics/alloy-furnace-gui-1.xcf b/graphics/alloy-furnace-gui-1.xcf index 04a727648244b8c28d90dc93a4292a2a5bc33d31..b1e253c5ffc46b9dd79481ff192297243ab6c80f 100644 GIT binary patch delta 1144 zcmc(fF=*6K7{~wbCAl+qo(h(`YfQY!=z)cENEJLPYU@p9b#@Sk+V-B`yF9T0w+=q|^8LTx_wnW9z2q%^;>#(Y z9b=P=$Bwerb3mT}jKe^28&KxJ_H#h>I8gfm4BrFnC1CF>WGkA|8*DVXrC*C|%?>9O zCdV%+y^FjwomiM>{Gp7SV15bQXT81;gTzKpq%7U&`Ct^S_k>9G^cRJGESNA-Em-q> z5vN+p11(-9oyKXv0zHgbhr%@Ng|QavQg^$gS4N!sQS=2q&8+vLZx+RDK^tF)83 z(i_vQt}5OlFXy4YwMw4VoaDyP40G%B+YOei-AP8Z^|u*N?A%bEaczTz5?N3IWJ2Srlwu}Mk delta 611 zcmY+CPbdUo7{;G(W(TvIKV|JQI}+u)ph#(JvuJBeIgyi48^;Z~x$MD7B$|WdPss`= zZQn(?sTC;>9B|n7A{V8cH|zcEckoR;^L+Dr-}jlfX&zsU+>@~tXXCk{80$U-jBUV| z0&3;}I}bD-15J}a=o4@_;6_lnyfL5P#;kfW$)$Xhu&gs<)$6nlytv_d1uMYKQB`gr zm!c7KT4!cj)K|I8dti&+wdHyj)d6mG=sj}I8qk@Q6vgUiliRN14!K35Ub|Ok_ON&h zL>c$5C@yE>m0tg*&iscWT6<;l;FRJrOYI(9&{;4eTEZKQhid=vdOFh%p>~~x`ow+n z664{l;&tRw)EmCkS@>3@oS?~_g5vW1Y6s_AXAwi}x8_;Ky{m9WCM9#-ci?=NbfVW< z`+%N#puYqp=({G8z(f}?Lm6rM0n${x(VEG5-zZ)yZ LZc3uqwy^OFU>Q`Z diff --git a/src/java/mmm/tech/base/TBAlloyFurnaceGui.java b/src/java/mmm/tech/base/TBAlloyFurnaceGui.java index a64a092..7705b98 100644 --- a/src/java/mmm/tech/base/TBAlloyFurnaceGui.java +++ b/src/java/mmm/tech/base/TBAlloyFurnaceGui.java @@ -3,6 +3,9 @@ package mmm.tech.base; import java.io.IOException; import java.util.ArrayList; +import java.util.List; + +import com.google.common.collect.Lists; import mmm.Mmm; import mmm.materials.MAlloyRecipe; @@ -16,6 +19,7 @@ import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -27,19 +31,22 @@ public class TBAlloyFurnaceGui { @SideOnly( Side.CLIENT ) private static enum Tab { - MAIN( 207 , 0 , 1 ) , - CONFIG( 191 , 0 , 2 ); + MAIN( 191 , 0 , 1 , "container.mmm.alloy_furnace.contents" ) , + RECIPE( 207 , 0 , 2 , "container.mmm.alloy_furnace.recipe" ) , + CONFIG( 223 , 0 , 2 , "gui.mmm.configure" ); public final int iconX; public final int iconY; public final int slotGroup; + public final String tooltip; - private Tab( final int iconX , final int iconY , final int slotGroup ) + private Tab( final int iconX , final int iconY , final int slotGroup , final String tooltip ) { this.iconX = iconX; this.iconY = iconY; this.slotGroup = slotGroup; + this.tooltip = tooltip; } } @@ -84,7 +91,8 @@ public class TBAlloyFurnaceGui private static final ResourceLocation TEXTURES[] = { new ResourceLocation( Mmm.ID , "textures/gui/alloy_furnace_1.png" ) , - new ResourceLocation( Mmm.ID , "textures/gui/alloy_furnace_2.png" ) + new ResourceLocation( Mmm.ID , "textures/gui/alloy_furnace_2.png" ) , + new ResourceLocation( Mmm.ID , "textures/gui/alloy_furnace_3.png" ) , }; private static final TBAlloyFurnaceGui.Tab TABS[] = TBAlloyFurnaceGui.Tab.values( ); @@ -140,7 +148,8 @@ public class TBAlloyFurnaceGui this.bPrevious = new ArrowButton( 1 , 8 + x , 47 + y , false ); this.bNext = new ArrowButton( 2 , 156 + x , 47 + y , true ); - this.bConfirm = new GuiButton( 3 , 24 + x , 84 + y , 128 , 20 , I18n.format( "gui.mmm.select_recipe" ) ); + this.bConfirm = new GuiButton( 3 , 24 + x , 84 + y , 128 , 20 , + I18n.format( "container.mmm.alloy_furnace.select" ) ); this.tfSearch = new GuiTextField( 4 , this.fontRendererObj , 24 + x , 9 + y , 128 , 20 ); this.tfSearch.setTextColor( 0xffffff ); @@ -163,13 +172,22 @@ public class TBAlloyFurnaceGui public void drawScreen( final int mouseX , final int mouseY , final float partialTicks ) { super.drawScreen( mouseX , mouseY , partialTicks ); + + for ( final TBAlloyFurnaceGui.Tab tab : TBAlloyFurnaceGui.Tab.values( ) ) { + if ( this.isInTab( tab , mouseX , mouseY ) ) { + final List< String > list = Lists.< String > newArrayList( ); + list.add( TextFormatting.WHITE + I18n.format( tab.tooltip ) ); + this.drawHoveringText( list , mouseX , mouseY ); + break; + } + } } private void enableConfigButtons( ) { if ( this.bNext != null ) { - final boolean visible = this.selectedTab == Tab.CONFIG; + final boolean visible = this.selectedTab == Tab.RECIPE; this.bNext.visible = this.bPrevious.visible = this.bConfirm.visible = visible; this.tfSearch.setVisible( visible ); @@ -270,27 +288,28 @@ public class TBAlloyFurnaceGui super.mouseClicked( mouseX , mouseY , mouseButton ); for ( final TBAlloyFurnaceGui.Tab tab : TBAlloyFurnaceGui.Tab.values( ) ) { - if ( this.selectedTab == tab ) { - continue; - } - - final int tabOffsetX = tab.ordinal( ) * TBAlloyFurnaceGui.TAB_WIDTH; - final int tabX = this.guiLeft + tabOffsetX + TBAlloyFurnaceGui.TAB_BORDER; - final int tabY = this.guiTop - TBAlloyFurnaceGui.TAB_HEIGHT + TBAlloyFurnaceGui.TAB_BORDER; - - if ( mouseX >= tabX && mouseY >= tabY && mouseX <= tabX + TBAlloyFurnaceGui.TAB_WIDTH - && mouseY <= tabY + TBAlloyFurnaceGui.TAB_HEIGHT ) { + if ( this.selectedTab != tab && this.isInTab( tab , mouseX , mouseY ) ) { this.selectTab( tab ); return; } } - if ( this.selectedTab == Tab.CONFIG ) { + if ( this.selectedTab == Tab.RECIPE ) { this.tfSearch.mouseClicked( mouseX , mouseY , mouseButton ); } } + private boolean isInTab( final TBAlloyFurnaceGui.Tab tab , final int mouseX , final int mouseY ) + { + final int tabOffsetX = tab.ordinal( ) * TBAlloyFurnaceGui.TAB_WIDTH; + final int tabX = this.guiLeft + tabOffsetX + TBAlloyFurnaceGui.TAB_BORDER; + final int tabY = this.guiTop - TBAlloyFurnaceGui.TAB_HEIGHT + TBAlloyFurnaceGui.TAB_BORDER; + return mouseX >= tabX && mouseY >= tabY && mouseX <= tabX + TBAlloyFurnaceGui.TAB_WIDTH + && mouseY <= tabY + TBAlloyFurnaceGui.TAB_HEIGHT; + } + + @Override protected void keyTyped( final char typedChar , final int keyCode ) throws IOException @@ -310,7 +329,7 @@ public class TBAlloyFurnaceGui return; } - MAlloyRecipe selected = this.currentRecipe == -1 ? null : this.recipes.get( this.currentRecipe ); + final MAlloyRecipe selected = this.currentRecipe == -1 ? null : this.recipes.get( this.currentRecipe ); final ArrayList< MAlloyRecipe > fullList = MAlloyRecipe.REGISTRY.getRecipes( ); this.searchString = newText; if ( "".equals( newText ) ) { diff --git a/src/resources/assets/mmm/lang/en_US.lang b/src/resources/assets/mmm/lang/en_US.lang index 4579bba..7f205d2 100644 --- a/src/resources/assets/mmm/lang/en_US.lang +++ b/src/resources/assets/mmm/lang/en_US.lang @@ -1,4 +1,4 @@ -gui.mmm.select_recipe=Select Recipe +gui.mmm.configure=Configure @@ -17,6 +17,9 @@ tile.mmm.materials.ore.cuprite.name=Cuprite Ore item.mmm.tech.base.alloy_furnace.name=Alloy Furnace +container.mmm.alloy_furnace.contents=Furnace Contents +container.mmm.alloy_furnace.recipe=Alloy Selection +container.mmm.alloy_furnace.select=Select Alloy item.mmm.tech.tools.copper.shovel.name=Copper Shovel diff --git a/src/resources/assets/mmm/textures/gui/alloy_furnace_1.png b/src/resources/assets/mmm/textures/gui/alloy_furnace_1.png index 2fded745ce4f251adcbc7f64d0a3466b4cf504b1..377c33ee798e45162c8005740def80d40146d503 100644 GIT binary patch literal 2397 zcmbtVXIK+R8XiI*p`B!j1q2fi7TBY?u%J>BFp3CdSwLx#B1&1LL|PC+f_rEb3CIZ+ z;6S8^B2|nu!ILJkR4GRZB_LqHNDqOK3+lPg-rt=cGxN;M^M3F9e&5Vox5Hb?NGeDI z0A#FA;_Lws5l%$_TwFL1Eo*4Jv^P`th^7rBea5i$d-2y(SBW^EkW8o>0hJMwAbUU2e z8XI?EG`B5;kvw&>T$NoC9?n_DqSKnnii??99Y<2!)fSH{=qaTfN=&CmZFvO`vnTgSt%F9rm(BC+7vTqc z4ULSvqoR&PL`3xT`!>Q5L|v7q&)Q{QvWb_7M^yNVh((8=pgv~~DowdC%Emb(RiTbu zCGK?}0*X*5lfcZfq_87;54rauepX50(^kyWW&O0bqZbMUw#NxU}9rd1feq>O%oGd zypN+bQ@OsIXJnePGA@JLr}7>M#(z&Y@{Wu&a$sp`X(6ja$|Kyb9YF~R%xo9%ZR4HB zL}|n79#MgT+RvXqKSv~%1$2AVlFH^HH#axc@vFTQoNDBd*>KW)D)pW@zDuuvVBibf z;3jP(BPn8k?1G`VrIvQW4km42kI0rOcgj46Rxjw#u()1l;!uf zjGQdLMJaHpVDzd7!wIIq--8%4N#L?hEsJk)ZoL~jkP#*oXO<8<*`y0vPfu8eF&9d% zV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