Fix speed calc in GUI from #934

Unmerged 1.6.4 commit: Multiple bugfixes #927
This commit is contained in:
Bernhard Bonigl committed 2014-08-28 14:29:08 +02:00
1 parent f33e7a535e
commit 7ca3acad88
2 files changed
+19 -5

No files matched your search

@@ -336,9 +336,16 @@ public class CraftingStationGui extends GuiContainer
heads++;
}
float trueSpeed = mineSpeed / (heads * 100f) * ((HarvestTool) tool).breakSpeedModifier();
float trueSpeed = mineSpeed / (heads * 100f);
if(tool instanceof HarvestTool)
trueSpeed *= ((HarvestTool) tool).breakSpeedModifier();
float localStonebound = 72f;
if (tool instanceof HarvestTool)
localStonebound = ((HarvestTool) tool).stoneboundModifier();
float stoneboundSpeed = (float) Math.log(durability / localStonebound + 1) * 2 * stonebound;
float stoneboundSpeed = (float) Math.log(durability / ((HarvestTool) tool).stoneboundModifier() + 1) * 2 * stonebound;
DecimalFormat df = new DecimalFormat("##.##");
df.setRoundingMode(RoundingMode.DOWN);
trueSpeed += stoneboundSpeed;
@@ -346,7 +353,7 @@ public class CraftingStationGui extends GuiContainer
trueSpeed = 0;
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation14") + df.format(trueSpeed), offsetX + 8, base + offset * 10, 0xffffff);
offset++;
if (stoneboundSpeed != 0)
if (stoneboundSpeed != 0 && !Float.isNaN(stoneboundSpeed))
{
String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4") : StatCollector.translateToLocal("gui.toolstation5");
fontRendererObj.drawString(bloss + df.format(stoneboundSpeed), xSize + 8, base + offset * 10, 0xffffff);
@@ -345,9 +345,16 @@ public class ToolStationGui extends GuiContainer
heads++;
}
float trueSpeed = mineSpeed / (heads * 100f) * ((HarvestTool) tool).breakSpeedModifier();
float trueSpeed = mineSpeed / (heads * 100f);
if(tool instanceof HarvestTool)
trueSpeed *= ((HarvestTool) tool).breakSpeedModifier();
float localStonebound = 72f;
if (tool instanceof HarvestTool)
localStonebound = ((HarvestTool) tool).stoneboundModifier();
float stoneboundSpeed = (float) Math.log(durability / localStonebound + 1) * 2 * stonebound;
float stoneboundSpeed = (float) Math.log(durability / ((HarvestTool) tool).stoneboundModifier() + 1) * 2 * stonebound;
DecimalFormat df = new DecimalFormat("##.##");
df.setRoundingMode(RoundingMode.DOWN);
trueSpeed += stoneboundSpeed;