mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 11:59:14 +00:00
Unify tool speed calculation in one accessible place, instead of having the same code floating around 3 times.
This commit is contained in:
1 parent
7ca3acad88
commit
2dd426f1d7
4 files changed
+52
-89
No files matched your search
@@ -17,6 +17,7 @@ import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
@@ -315,36 +316,8 @@ public class CraftingStationGui extends GuiContainer
|
||||
}
|
||||
else if (categories.contains("harvest"))
|
||||
{
|
||||
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);
|
||||
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 trueSpeed = AbilityHelper.calcToolSpeed(tool, tags);
|
||||
float stoneboundSpeed = AbilityHelper.calcToolSpeed(tool, tags);
|
||||
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
|
||||
Reference in new issue
Block a user