mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-14 01:14:18 +00:00
Move DualHarvest speed calc also into AbilityHelper
This commit is contained in:
1 parent
5495722194
commit
e6469587fe
2 files changed
+20
-20
No files matched your search
@@ -699,6 +699,22 @@ public class AbilityHelper
|
||||
return trueSpeed;
|
||||
}
|
||||
|
||||
public static float calcDualToolSpeed (ToolCore tool, NBTTagCompound tags, boolean secondary)
|
||||
{
|
||||
String tag = "MiningSpeed";
|
||||
if(secondary) tag += "2";
|
||||
|
||||
float mineSpeed = tags.getInteger(tag);
|
||||
float speedMod = 1f;
|
||||
if (tool instanceof HarvestTool)
|
||||
speedMod = ((HarvestTool) tool).breakSpeedModifier();
|
||||
|
||||
float trueSpeed = mineSpeed / 100f * speedMod;
|
||||
trueSpeed += calcStoneboundBonus(tool, tags);
|
||||
|
||||
return trueSpeed;
|
||||
}
|
||||
|
||||
public static float calcStoneboundBonus (ToolCore tool, NBTTagCompound tags)
|
||||
{
|
||||
int durability = tags.getInteger("Damage");
|
||||
|
||||
@@ -56,16 +56,8 @@ public abstract class DualHarvestTool extends HarvestTool
|
||||
{
|
||||
if (materials[i] == block.getMaterial())
|
||||
{
|
||||
float speed = tags.getInteger("MiningSpeed");
|
||||
speed /= 100f;
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
int durability = tags.getInteger("Damage");
|
||||
|
||||
float shoddy = tags.getFloat("Shoddy");
|
||||
speed += shoddy * durability / 100f;
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
return speed;
|
||||
if (block.getHarvestLevel(meta) <= tags.getInteger("HarvestLevel"))
|
||||
AbilityHelper.calcDualToolSpeed(this, tags, false);
|
||||
return 0.1f;
|
||||
}
|
||||
}
|
||||
@@ -74,16 +66,8 @@ public abstract class DualHarvestTool extends HarvestTool
|
||||
{
|
||||
if (materials[i] == block.getMaterial())
|
||||
{
|
||||
float speed = tags.getInteger("MiningSpeed2");
|
||||
speed /= 100f;
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
int durability = tags.getInteger("Damage");
|
||||
|
||||
float shoddy = tags.getFloat("Shoddy");
|
||||
speed += shoddy * durability / 100f;
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel2"))
|
||||
return speed;
|
||||
if (block.getHarvestLevel(meta) <= tags.getInteger("HarvestLevel2"))
|
||||
AbilityHelper.calcDualToolSpeed(this, tags, true);
|
||||
return 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user