From 24e0e9fcc334510c6e61790b9aa3e87a55ee622b Mon Sep 17 00:00:00 2001 From: Bernhard Bonigl Date: Thu, 11 Sep 2014 17:46:53 +0200 Subject: [PATCH] Smeltery-Gui for the flexible smeltery and some gui polishing --- .../tinker/textures/gui/smelteryside.png | Bin 1881 -> 1260 bytes .../tconstruct/smeltery/gui/SmelteryGui.java | 40 +++++++++++------- .../smeltery/gui/SmelteryGuiOld.java | 4 +- .../smeltery/inventory/SmelteryContainer.java | 2 + 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/resources/assets/tinker/textures/gui/smelteryside.png b/resources/assets/tinker/textures/gui/smelteryside.png index 7516db38836ca415460ddaa2f929ca09e4165bc7..5a34e41691a40be206ca7b0b6cb27306bd56ef2f 100644 GIT binary patch literal 1260 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G!U;i$lZxy-8q?;Kn`1yx4R3& ze-K=-cll(X2xoyuWHAE+w=f7ZGR&GI0Tg5}@$_|NzsJeVudAZja=M3sfhEV&#WAGf z*4sP2e#-6=4G-5ZE@1O}sLOTM^q11KUt$}NIKHSYVlf8u z$t;)CTz_lb^GM0WuO3TRUcbs)<61Mlso690?^F3+H$w@YYjyuita^8?<6eEn+rIw) z|MdUzx8A;e8})v+j~Y<=(Z7FnYrosu*hIwCNifXb?|$s@$JzJy@7h)M?d#pUcW1x1 zx3}NEVvP-B&L7PqWwCK_dUqeJzVRSOm%(hmFvHCG3>G@-3@isY4{$adW>2t?$@?q6 zW|h{gWtOX6@4Hj-K5}~M^+Kiv-_;vdt(q5S?)&-8>+dUG|GHZGtL|>P<45x#sV`mnE`^%Kdxuua454oA0!gEgMEQL1VhVX3ehwY4F=94=e9!P>b0Q4=yC)gO)>CjM`$>DO0 z@rBueM`=ca9AFn?cOul@gy%qaF-DwoQ2=_^0xfWHTgSxk2I#ryU*!)ZLo!3Wxb0Sg2jpb7#S3n5t7 z(ljboY=IggS}P2cS2H}Mh#3@-3JEjml1M;O9!44hh&;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BY2=^V-t)b5Vt6@YBLyMt)*1bW(ywsH!u{v|J`Z*Kls3<-K*ZgBAN;G$k$}TNSwo zokzH)gY~u%X=`&yge5Teuc#u9w_qzs_8C;s$z0MYpto?DQe<8>Cg9;b0*V}rVO72Hfwp!hkA+c4AkB`d_thj7WE361R*4~6v z&&>&ivwdXdx0im=YPI{;WXry=w>(D)M~`N0wwIE)J|mbwY88>Yzd z7c&os`$FJT&43rp$4WpR@T?)eV&Z$Z82+vLFzRnsT=2b?Y3*~gU6x=3+x z(|#lS?>#Y3@-j5d+Rv?lXy`3bADP3=gwXZFp8aHyyzT`7RUegXw#F{jy+L*Ne&i@T=%EajZRQ8#4YcL9yZ~L}D KZt0eYlm7)Y{MTmy diff --git a/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java b/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java index e2db7634..dd26c18b 100644 --- a/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java +++ b/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java @@ -52,7 +52,7 @@ public class SmelteryGui extends NewContainerGui protected void updateScrollbar (int mouseX, int mouseY, float par3) { - if (logic.layers > 2) + if (logic.getBlockCapacity() > 18) { boolean mouseDown = Mouse.isButtonDown(0); int lefto = this.guiLeft; @@ -110,6 +110,7 @@ public class SmelteryGui extends NewContainerGui int cornerX = (width - xSize) / 2 + 36; int cornerY = (height - ySize) / 2; + // molten metals for (FluidStack liquid : logic.moltenMetal) { int basePos = 54; @@ -138,6 +139,7 @@ public class SmelteryGui extends NewContainerGui } } + // lava/fuel if (logic.fuelGague > 0) { int leftX = cornerX + 117; @@ -153,7 +155,6 @@ public class SmelteryGui extends NewContainerGui private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/smeltery.png"); private static final ResourceLocation backgroundSide = new ResourceLocation("tinker", "textures/gui/smelteryside.png"); - private static final ResourceLocation terrain = new ResourceLocation("terrain.png"); @Override protected void drawGuiContainerBackgroundLayer (float f, int mouseX, int mouseY) @@ -221,30 +222,33 @@ public class SmelteryGui extends NewContainerGui // Side inventory GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(backgroundSide); - if (logic.layers > 0) + if (logic.getBlockCapacity() > 0) { - if (logic.layers == 1) + int h = logic.getBlockCapacity()/3; + if(logic.getBlockCapacity()%3 != 0) + h++; + + if(h >= 8) { - drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, 43); - drawTexturedModalRect(cornerX - 46, cornerY + 43, 0, 133, 98, 25); - } - else if (logic.layers == 2) - { - drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, 61); - drawTexturedModalRect(cornerX - 46, cornerY + 61, 0, 97, 98, 61); + drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 97, ySize - 8); + drawTexturedModalRect(cornerX + 32, (int) (cornerY + 8 + 127 * currentScroll), 98, 0, 12, 15); } else { - drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, ySize - 8); + int yd = 43 + 18*(h-3); + drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 97, yd); + drawTexturedModalRect(cornerX - 46, cornerY + yd, 0, 133, 97, 25); + + drawTexturedModalRect(cornerX + 32, (int) (cornerY + 8 + 127 * currentScroll), 110, 0, 12, 15); } - drawTexturedModalRect(cornerX + 32, (int) (cornerY + 8 + 127 * currentScroll), 98, 0, 12, 15); } // Temperature - int slotSize = logic.layers * 9; + int slotSize = logic.getBlockCapacity(); if (slotSize > 24) slotSize = 24; - for (int iter = 0; iter < slotSize; iter++) + int iter; + for (iter = 0; iter < slotSize && iter + slotPos*3 < logic.getBlockCapacity(); iter++) { int slotTemp = logic.getTempForSlot(iter + slotPos * 3) - 20; int maxTemp = logic.getMeltingPointForSlot(iter + slotPos * 3) - 20; @@ -254,6 +258,12 @@ public class SmelteryGui extends NewContainerGui drawTexturedModalRect(cornerX - 38 + (iter % 3 * 22), cornerY + 8 + (iter / 3 * 18) + 16 - size, 98, 15 + 16 - size, 5, size); } } + + // hide nonexistant slots + for (; iter < slotSize; iter++) + { + drawTexturedModalRect(cornerX - 38 + (iter % 3 * 22)-1, cornerY + 8 + (iter / 3 * 18)-1, 98, 47, 22, 18); + } } protected void drawFluidStackTooltip (FluidStack par1ItemStack, int par2, int par3) diff --git a/src/main/java/tconstruct/smeltery/gui/SmelteryGuiOld.java b/src/main/java/tconstruct/smeltery/gui/SmelteryGuiOld.java index d4433eb4..045e6639 100644 --- a/src/main/java/tconstruct/smeltery/gui/SmelteryGuiOld.java +++ b/src/main/java/tconstruct/smeltery/gui/SmelteryGuiOld.java @@ -16,7 +16,7 @@ import org.lwjgl.opengl.GL12; import tconstruct.TConstruct; import tconstruct.client.gui.NewContainerGui; import tconstruct.smeltery.inventory.ActiveContainer; -import tconstruct.smeltery.inventory.SmelteryContainer; +import tconstruct.smeltery.inventory.SmelteryContainerOld; import tconstruct.smeltery.logic.SmelteryLogicOld; import tconstruct.util.network.SmelteryPacket; @@ -102,7 +102,7 @@ public class SmelteryGuiOld extends NewContainerGui this.currentScroll = 1.0F; } - int s = ((SmelteryContainer) this.container).scrollTo(this.currentScroll); + int s = ((SmelteryContainerOld) this.container).scrollTo(this.currentScroll); if (s != -1) slotPos = s; } diff --git a/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java b/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java index 9a25dae2..75b3da50 100644 --- a/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java +++ b/src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java @@ -80,6 +80,8 @@ public class SmelteryContainer extends ActiveContainer public int scrollTo (float scrollPos) { float total = (logic.getSizeInventory() - 24) / 3; + if((logic.getSizeInventory() - 24)%3 != 0) + total++; int rowPos = Math.round(total * scrollPos); return updateRows(rowPos); }