Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mDiyo/TinkersConstruct
Browse files Browse the repository at this point in the history
  • Loading branch information
progwml6 committed Sep 19, 2013
2 parents fd4e335 + 542bf5c commit eea1a52
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 34 deletions.
11 changes: 7 additions & 4 deletions src/tconstruct/client/gui/SmelteryGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,13 @@ protected void drawGuiContainerForegroundLayer (int mouseX, int mouseY)
{
int total = logic.getTotalLiquid();
int liquidLayers = (total / 20000 + 1) * 20000;
liquidSize = liquid.amount * 52 / liquidLayers;
if (liquidSize == 0)
liquidSize = 1;
base += liquidSize;
if (liquidLayers > 0)
{
liquidSize = liquid.amount * 52 / liquidLayers;
if (liquidSize == 0)
liquidSize = 1;
base += liquidSize;
}
}

int leftX = cornerX + basePos;
Expand Down
69 changes: 39 additions & 30 deletions src/tconstruct/library/tools/HarvestTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,40 +70,49 @@ public float getStrVsBlock (ItemStack stack, Block block, int meta)
{
if (materials[i] == block.blockMaterial)
{
float mineSpeed = tags.getInteger("MiningSpeed");
int heads = 1;
if (tags.hasKey("MiningSpeed2"))
{
mineSpeed += tags.getInteger("MiningSpeed2");
heads++;
}

if (tags.hasKey("MiningSpeedHandle"))
{
mineSpeed += tags.getInteger("MiningSpeedHandle");
heads++;
}

if (tags.hasKey("MiningSpeedExtra"))
{
mineSpeed += tags.getInteger("MiningSpeedExtra");
heads++;
}
float trueSpeed = mineSpeed / (heads * 100f);
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
int durability = tags.getInteger("Damage");

float stonebound = tags.getFloat("Shoddy");
float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
trueSpeed += bonusLog;

if (hlvl <= tags.getInteger("HarvestLevel"))
return trueSpeed;
return 0.1f;
return calculateStrength(tags, block, meta);
}
}
if (MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType()) > 0)
{
return calculateStrength(tags, block, meta); //No issue if the harvest level is too low
}
return super.getStrVsBlock(stack, block, meta);
}

float calculateStrength(NBTTagCompound tags, Block block, int meta)
{
float mineSpeed = tags.getInteger("MiningSpeed");
int heads = 1;
if (tags.hasKey("MiningSpeed2"))
{
mineSpeed += tags.getInteger("MiningSpeed2");
heads++;
}

if (tags.hasKey("MiningSpeedHandle"))
{
mineSpeed += tags.getInteger("MiningSpeedHandle");
heads++;
}

if (tags.hasKey("MiningSpeedExtra"))
{
mineSpeed += tags.getInteger("MiningSpeedExtra");
heads++;
}
float trueSpeed = mineSpeed / (heads * 100f);
int hlvl = MinecraftForge.getBlockHarvestLevel(block, meta, getHarvestType());
int durability = tags.getInteger("Damage");

float stonebound = tags.getFloat("Shoddy");
float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
trueSpeed += bonusLog;

if (hlvl <= tags.getInteger("HarvestLevel"))
return trueSpeed;
return 0.1f;
}

public boolean canHarvestBlock (Block block)
{
Expand Down

0 comments on commit eea1a52

Please sign in to comment.