Smeltery-Gui for the flexible smeltery and some gui polishing

This commit is contained in:
Bernhard Bonigl committed 2014-09-11 17:46:53 +02:00
1 parent 7c4c9b55c0
commit 24e0e9fcc3
4 files changed
+29 -17

No files matched your search

@@ -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)
@@ -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;
}
@@ -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);
}