ItemPickaxeStarTreckMod.java (2573B)
1 package mtrnord.StarTreckMod; 2 3 import net.minecraft.block.Block; 4 import net.minecraft.block.material.Material; 5 import net.minecraft.item.EnumToolMaterial; 6 import net.minecraft.item.ItemStack; 7 import net.minecraft.item.ItemTool; 8 9 public class ItemPickaxeStarTreckMod extends ItemToolStarTreckMod 10 { 11 /** an array of the blocks this pickaxe is effective against */ 12 public static final Block[] blocksEffectiveAgainst = new Block[] {Block.cobblestone, Block.stoneDoubleSlab, Block.stoneSingleSlab, 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}; 13 14 public ItemPickaxeStarTreckMod(int par1, EnumToolMaterialStarTreck par2EnumToolMaterial) 15 { 16 super(par1, 2.0F, par2EnumToolMaterial, blocksEffectiveAgainst); 17 } 18 19 /** 20 * Returns if the item (tool) can harvest results from the block type. 21 */ 22 public boolean canHarvestBlock(Block par1Block) 23 { 24 return par1Block == Block.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (par1Block != Block.blockDiamond && par1Block != Block.oreDiamond ? (par1Block != Block.oreEmerald && par1Block != Block.blockEmerald ? (par1Block != Block.blockGold && par1Block != Block.oreGold ? (par1Block != Block.blockIron && par1Block != Block.oreIron ? (par1Block != Block.blockLapis && par1Block != Block.oreLapis ? (par1Block != Block.oreRedstone && par1Block != Block.oreRedstoneGlowing ? (par1Block.blockMaterial == Material.rock ? true : (par1Block.blockMaterial == Material.iron ? true : par1Block.blockMaterial == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2); 25 } 26 27 /** 28 * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if 29 * sword 30 */ 31 public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) 32 { 33 return par2Block != null && (par2Block.blockMaterial == Material.iron || par2Block.blockMaterial == Material.anvil || par2Block.blockMaterial == Material.rock) ? this.efficiencyOnProperMaterial : super.getStrVsBlock(par1ItemStack, par2Block); 34 } 35 } 36