mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
Merge pull request #934 from squeek502/broad-tools
Merge: Buff redstone mod, refactor broad tools to match
This commit is contained in:
commit
52be72de5a
7 files changed
+46
-168
No files matched your search
@@ -239,53 +239,15 @@ public class Excavator extends HarvestTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed (ItemStack stack, Block block, int meta)
|
||||
public float breakSpeedModifier ()
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return 1.0f;
|
||||
return 0.4f;
|
||||
}
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Broken"))
|
||||
return 0.1f;
|
||||
|
||||
Material[] materials = getEffectiveMaterials();
|
||||
for (int i = 0; i < materials.length; i++)
|
||||
{
|
||||
if (materials[i] == block.getMaterial())
|
||||
{
|
||||
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 * 300f);
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
int durability = tags.getInteger("Damage");
|
||||
|
||||
float stonebound = tags.getFloat("Shoddy");
|
||||
float bonusLog = (float) Math.log(durability / 216f + 1) * 2 * stonebound;
|
||||
trueSpeed += bonusLog;
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
return trueSpeed;
|
||||
return 0.1f;
|
||||
}
|
||||
}
|
||||
return super.getDigSpeed(stack, block, meta);
|
||||
@Override
|
||||
public float stoneboundModifier ()
|
||||
{
|
||||
return 216f;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -344,75 +344,17 @@ public class Hammer extends HarvestTool
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed (ItemStack stack, Block block, int meta)
|
||||
public float breakSpeedModifier ()
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return 1.0f;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Broken"))
|
||||
return 0.1f;
|
||||
|
||||
Material[] materials = getEffectiveMaterials();
|
||||
for (int i = 0; i < materials.length; i++)
|
||||
{
|
||||
if (materials[i] == block.getMaterial())
|
||||
{
|
||||
return getblockSpeed(tags, block, meta);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* if (block == Block.silverfish) return getblockSpeed(tags, block,
|
||||
* meta);
|
||||
*/
|
||||
|
||||
return super.getDigSpeed(stack, block, meta);
|
||||
return 0.4f;
|
||||
}
|
||||
|
||||
float getblockSpeed (NBTTagCompound tags, Block block, int meta)
|
||||
@Override
|
||||
public float stoneboundModifier ()
|
||||
{
|
||||
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 * 300f);
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
int durability = tags.getInteger("Damage");
|
||||
|
||||
float stonebound = tags.getFloat("Shoddy");
|
||||
float bonusLog = (float) Math.log(durability / 216f + 1) * 2 * stonebound;
|
||||
trueSpeed += bonusLog;
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
return trueSpeed;
|
||||
return 0.1f;
|
||||
return 216f;
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public void onUpdate (ItemStack stack, World world, Entity
|
||||
* entity, int par4, boolean par5) { super.onUpdate(stack, world, entity,
|
||||
* par4, par5); if (entity instanceof EntityPlayer) { EntityPlayer player =
|
||||
* (EntityPlayer) entity; ItemStack equipped =
|
||||
* player.getCurrentEquippedItem(); if (equipped == stack) {
|
||||
* player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 1, 1)); }
|
||||
* } }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
|
||||
@@ -79,53 +79,15 @@ public class LumberAxe extends HarvestTool
|
||||
*/
|
||||
|
||||
@Override
|
||||
public float getDigSpeed (ItemStack stack, Block block, int meta)
|
||||
public float breakSpeedModifier ()
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return 1.0f;
|
||||
return 0.4f;
|
||||
}
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getBoolean("Broken"))
|
||||
return 0.1f;
|
||||
|
||||
Material[] materials = getEffectiveMaterials();
|
||||
for (int i = 0; i < materials.length; i++)
|
||||
{
|
||||
if (materials[i] == block.getMaterial())
|
||||
{
|
||||
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 * 300f);
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
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 super.getDigSpeed(stack, block, meta);
|
||||
@Override
|
||||
public float stoneboundModifier ()
|
||||
{
|
||||
return 216f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -160,18 +160,28 @@ public abstract class HarvestTool extends ToolCore
|
||||
mineSpeed += tags.getInteger("MiningSpeedExtra");
|
||||
heads++;
|
||||
}
|
||||
float trueSpeed = mineSpeed / (heads * 100f);
|
||||
float trueSpeed = mineSpeed / (heads * 100f) * breakSpeedModifier();
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
int durability = tags.getInteger("Damage");
|
||||
|
||||
float stonebound = tags.getFloat("Shoddy");
|
||||
float bonusLog = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
float bonusLog = (float) Math.log(durability / stoneboundModifier() + 1) * 2 * stonebound;
|
||||
trueSpeed += bonusLog;
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
return trueSpeed;
|
||||
return 0.1f;
|
||||
}
|
||||
|
||||
public float breakSpeedModifier()
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public float stoneboundModifier()
|
||||
{
|
||||
return 72f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_150897_b (Block block)
|
||||
|
||||
@@ -80,11 +80,11 @@ public class ModRepair extends ItemModifier
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
float mods = 1.0f;
|
||||
if (modifiers == 2)
|
||||
mods = 0.8f;
|
||||
mods = 0.9f;
|
||||
else if (modifiers == 1)
|
||||
mods = 0.6f;
|
||||
mods = 0.8f;
|
||||
else if (modifiers == 0)
|
||||
mods = 0.4f;
|
||||
mods = 0.7f;
|
||||
|
||||
increase *= mods;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.world.World;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
|
||||
@@ -286,9 +287,9 @@ public class CraftingStationGui extends GuiContainer
|
||||
// Mining
|
||||
if (categories.contains("dualharvest"))
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed") / 100f;
|
||||
float mineSpeed2 = tags.getInteger("MiningSpeed2") / 100f;
|
||||
float stoneboundSpeed = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
float mineSpeed = tags.getInteger("MiningSpeed") / 100f * ((HarvestTool) tool).breakSpeedModifier();
|
||||
float mineSpeed2 = tags.getInteger("MiningSpeed2") / 100f * ((HarvestTool) tool).breakSpeedModifier();
|
||||
float stoneboundSpeed = (float) Math.log(durability / ((HarvestTool) tool).stoneboundModifier() + 1) * 2 * stonebound;
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
float trueSpeed = mineSpeed + stoneboundSpeed;
|
||||
@@ -335,9 +336,9 @@ public class CraftingStationGui extends GuiContainer
|
||||
heads++;
|
||||
}
|
||||
|
||||
float trueSpeed = mineSpeed / (heads * 100f);
|
||||
float trueSpeed = mineSpeed / (heads * 100f) * ((HarvestTool) tool).breakSpeedModifier();
|
||||
|
||||
float stoneboundSpeed = (float) Math.log(durability / 72f + 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;
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.client.TConstructClientRegistry;
|
||||
import tconstruct.library.client.ToolGuiElement;
|
||||
import tconstruct.library.tools.HarvestTool;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.library.util.HarvestLevels;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
@@ -296,9 +297,9 @@ public class ToolStationGui extends GuiContainer
|
||||
// Mining
|
||||
if (categories.contains("dualharvest"))
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed") / 100f;
|
||||
float mineSpeed2 = tags.getInteger("MiningSpeed2") / 100f;
|
||||
float stoneboundSpeed = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
float mineSpeed = tags.getInteger("MiningSpeed") / 100f * ((HarvestTool) tool).breakSpeedModifier();
|
||||
float mineSpeed2 = tags.getInteger("MiningSpeed2") / 100f * ((HarvestTool) tool).breakSpeedModifier();
|
||||
float stoneboundSpeed = (float) Math.log(durability / ((HarvestTool) tool).stoneboundModifier() + 1) * 2 * stonebound;
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
float trueSpeed = mineSpeed + stoneboundSpeed;
|
||||
@@ -344,9 +345,9 @@ public class ToolStationGui extends GuiContainer
|
||||
heads++;
|
||||
}
|
||||
|
||||
float trueSpeed = mineSpeed / (heads * 100f);
|
||||
float trueSpeed = mineSpeed / (heads * 100f) * ((HarvestTool) tool).breakSpeedModifier();
|
||||
|
||||
float stoneboundSpeed = (float) Math.log(durability / 72f + 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;
|
||||
|
||||
Reference in new issue
Block a user