2013-08-27 00:49:32 +02:00
|
|
|
package mekanism.tools.item;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
2012-12-20 22:53:39 +01:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.item.EnumToolMaterial;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2012-08-15 22:41:41 +02:00
|
|
|
|
2012-11-05 20:29:04 +01:00
|
|
|
public class ItemMekanismPickaxe extends ItemMekanismTool
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
private static Block blocksEffectiveAgainst[];
|
|
|
|
|
2012-11-29 02:03:55 +01:00
|
|
|
public ItemMekanismPickaxe(int id, EnumToolMaterial enumtoolmaterial)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
2012-11-29 02:03:55 +01:00
|
|
|
super(id, 2, enumtoolmaterial, blocksEffectiveAgainst);
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-11-29 02:03:55 +01:00
|
|
|
public boolean canHarvestBlock(Block block)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
2013-11-13 23:21:00 +01:00
|
|
|
if(block == Block.obsidian)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
return toolMaterial.getHarvestLevel() == 3;
|
|
|
|
}
|
|
|
|
|
2013-11-13 23:21:00 +01:00
|
|
|
if(block == Block.blockDiamond || block == Block.oreDiamond)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
return toolMaterial.getHarvestLevel() >= 2;
|
|
|
|
}
|
|
|
|
|
2013-11-13 23:21:00 +01:00
|
|
|
if(block == Block.blockGold || block == Block.oreGold)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
return toolMaterial.getHarvestLevel() >= 2;
|
|
|
|
}
|
|
|
|
|
2013-11-13 23:21:00 +01:00
|
|
|
if(block == Block.blockIron || block == Block.oreIron)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
return toolMaterial.getHarvestLevel() >= 1;
|
|
|
|
}
|
|
|
|
|
2013-11-13 23:21:00 +01:00
|
|
|
if(block == Block.blockLapis || block == Block.oreLapis)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
return toolMaterial.getHarvestLevel() >= 1;
|
|
|
|
}
|
|
|
|
|
2013-11-13 23:21:00 +01:00
|
|
|
if(block == Block.oreRedstone || block == Block.oreRedstoneGlowing)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
return toolMaterial.getHarvestLevel() >= 2;
|
|
|
|
}
|
|
|
|
|
2013-11-13 23:21:00 +01:00
|
|
|
if(block.blockMaterial == Material.rock)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-11-29 02:03:55 +01:00
|
|
|
return block.blockMaterial == Material.iron;
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
|
2012-11-06 16:44:14 +01:00
|
|
|
@Override
|
2012-11-29 02:03:55 +01:00
|
|
|
public float getStrVsBlock(ItemStack itemstack, Block block)
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
2013-11-13 23:21:00 +01:00
|
|
|
if(block != null && (block.blockMaterial == Material.iron || block.blockMaterial == Material.rock))
|
2012-08-15 22:41:41 +02:00
|
|
|
{
|
|
|
|
return efficiencyOnProperMaterial;
|
|
|
|
}
|
2013-11-13 23:21:00 +01:00
|
|
|
else {
|
2012-11-29 02:03:55 +01:00
|
|
|
return super.getStrVsBlock(itemstack, block);
|
2012-08-15 22:41:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static
|
|
|
|
{
|
|
|
|
blocksEffectiveAgainst = (new Block[]
|
|
|
|
{
|
2013-04-13 02:25:21 +02:00
|
|
|
Block.cobblestone, Block.stoneSingleSlab, Block.stoneDoubleSlab, Block.stone, Block.sandStone, Block.cobblestoneMossy, Block.oreIron, Block.blockIron, Block.oreCoal, Block.blockGold,
|
2012-08-15 22:41:41 +02:00
|
|
|
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
|
2012-08-15 22:41:41 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|