package mekanism.tools.item; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemStack; public class ItemMekanismPickaxe extends ItemMekanismTool { private static Block blocksEffectiveAgainst[]; public ItemMekanismPickaxe(int id, EnumToolMaterial enumtoolmaterial) { super(id, 2, enumtoolmaterial, blocksEffectiveAgainst); } @Override public boolean canHarvestBlock(Block block) { if(block == Block.obsidian) { return toolMaterial.getHarvestLevel() == 3; } if(block == Block.blockDiamond || block == Block.oreDiamond) { return toolMaterial.getHarvestLevel() >= 2; } if(block == Block.blockGold || block == Block.oreGold) { return toolMaterial.getHarvestLevel() >= 2; } if(block == Block.blockIron || block == Block.oreIron) { return toolMaterial.getHarvestLevel() >= 1; } if(block == Block.blockLapis || block == Block.oreLapis) { return toolMaterial.getHarvestLevel() >= 1; } if(block == Block.oreRedstone || block == Block.oreRedstoneGlowing) { return toolMaterial.getHarvestLevel() >= 2; } if(block.blockMaterial == Material.rock) { return true; } return block.blockMaterial == Material.iron; } @Override public float getStrVsBlock(ItemStack itemstack, Block block) { if(block != null && (block.blockMaterial == Material.iron || block.blockMaterial == Material.anvil || block.blockMaterial == Material.rock)) { return efficiencyOnProperMaterial; } else { return super.getStrVsBlock(itemstack, block); } } static { blocksEffectiveAgainst = (new Block[] { Block.cobblestone, Block.stoneSingleSlab, Block.stoneDoubleSlab, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockIron, Block.oreCoal, Block.blockGold, Block.oreGold, Block.oreDiamond, Block.blockDiamond, Block.ice, Block.netherrack, Block.oreLapis, Block.blockLapis, Block.oreRedstone, Block.oreRedstoneGlowing, Block.rail, Block.railDetector, Block.railPowered, Block.railActivator }); } }