Mekanism-tilera-Edition/common/mekanism/tools/item/ItemMekanismPickaxe.java

80 lines
2.4 KiB
Java
Raw Normal View History

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)
{
2013-11-13 23:21:00 +01:00
if(block == Block.obsidian)
{
return toolMaterial.getHarvestLevel() == 3;
}
2013-11-13 23:21:00 +01:00
if(block == Block.blockDiamond || block == Block.oreDiamond)
{
return toolMaterial.getHarvestLevel() >= 2;
}
2013-11-13 23:21:00 +01:00
if(block == Block.blockGold || block == Block.oreGold)
{
return toolMaterial.getHarvestLevel() >= 2;
}
2013-11-13 23:21:00 +01:00
if(block == Block.blockIron || block == Block.oreIron)
{
return toolMaterial.getHarvestLevel() >= 1;
}
2013-11-13 23:21:00 +01:00
if(block == Block.blockLapis || block == Block.oreLapis)
{
return toolMaterial.getHarvestLevel() >= 1;
}
2013-11-13 23:21:00 +01:00
if(block == Block.oreRedstone || block == Block.oreRedstoneGlowing)
{
return toolMaterial.getHarvestLevel() >= 2;
}
2013-11-13 23:21:00 +01:00
if(block.blockMaterial == Material.rock)
{
return true;
}
return block.blockMaterial == Material.iron;
}
@Override
public float getStrVsBlock(ItemStack itemstack, Block block)
{
2013-11-13 23:21:00 +01:00
if(block != null && (block.blockMaterial == Material.iron || block.blockMaterial == Material.rock))
{
return efficiencyOnProperMaterial;
}
2013-11-13 23:21:00 +01:00
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,
2013-11-13 23:21:00 +01:00
Block.railDetector, Block.railPowered, Block.railActivator
});
}
}