Skip to content

Commit

Permalink
Fix clicking fluids in the smeltery
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Sep 12, 2014
1 parent 48f9059 commit 9fabcc0
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions src/main/java/tconstruct/smeltery/gui/SmelteryGui.java
Expand Up @@ -505,39 +505,24 @@ public void mouseClicked (int mouseX, int mouseY, int mouseButton)
{
super.mouseClicked(mouseX, mouseY, mouseButton);

int base = 0;
int cornerX = (width - xSize) / 2 + 36;
int cornerY = (height - ySize) / 2;
int fluidToBeBroughtUp = -1;

for (FluidStack liquid : logic.moltenMetal)
int[] fluidHeights = calcLiquidHeights();
int base = 0;
for(int i = 0; i < fluidHeights.length; i++)
{
int basePos = 54;
int initialLiquidSize = 0;
int liquidSize = 0;// liquid.amount * 52 / liquidLayers;
if (logic.getCapacity() > 0)
{
int total = logic.getTotalLiquid();
int liquidLayers = (total / 20000 + 1) * 20000;
if (liquidLayers > 0)
{
liquidSize = liquid.amount * 52 / liquidLayers;
if (liquidSize == 0)
liquidSize = 1;
base += liquidSize;
}
}
int leftX = cornerX + 54;
int topY = (cornerY + 68) - fluidHeights[i] - base;

int leftX = cornerX + basePos;
int topY = (cornerY + 68) - base;
int sizeX = 52;
int sizeY = liquidSize;
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
if (mouseX >= leftX && mouseX <= leftX + 52 && mouseY >= topY && mouseY < topY + fluidHeights[i])
{
fluidToBeBroughtUp = liquid.fluidID;
fluidToBeBroughtUp = logic.moltenMetal.get(i).fluidID;

TConstruct.packetPipeline.sendToServer(new SmelteryPacket(logic.getWorldObj().provider.dimensionId, logic.xCoord, logic.yCoord, logic.zCoord, this.isShiftKeyDown(), fluidToBeBroughtUp));
}
base += fluidHeights[i];
}
}
}

0 comments on commit 9fabcc0

Please sign in to comment.