Merge pull request #747 from bonii-xx/master

Change harvest speed calculation to be accessible from subtypes.
This commit is contained in:
mDiyo committed 2014-07-15 16:46:11 -08:00
commit beffc0b162
1 file changed
+11 -7
@@ -49,7 +49,7 @@ public abstract class HarvestTool extends ToolCore
return super.getDigSpeed(stack, block, meta);
}
float calculateStrength (NBTTagCompound tags, Block block, int meta)
public float calculateStrength (NBTTagCompound tags, Block block, int meta)
{
float mineSpeed = tags.getInteger("MiningSpeed");
int heads = 1;
@@ -90,12 +90,7 @@ public abstract class HarvestTool extends ToolCore
{
return true;
}
for (Material m : getEffectiveMaterials())
{
if (m == block.getMaterial())
return true;
}
return false;
return isEffective(block.getMaterial());
}
@Override
@@ -114,6 +109,15 @@ public abstract class HarvestTool extends ToolCore
protected abstract String getHarvestType ();
public boolean isEffective(Material material)
{
for(Material m : getEffectiveMaterials())
if(m == material)
return true;
return false;
}
//Right-click
@Override
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)