base mod created
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
package net.minecraft.item;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Set;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
||||
public class ItemPickaxe extends ItemTool
|
||||
{
|
||||
private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.ACTIVATOR_RAIL, Blocks.COAL_ORE, Blocks.COBBLESTONE, Blocks.DETECTOR_RAIL, Blocks.DIAMOND_BLOCK, Blocks.DIAMOND_ORE, Blocks.DOUBLE_STONE_SLAB, Blocks.GOLDEN_RAIL, Blocks.GOLD_BLOCK, Blocks.GOLD_ORE, Blocks.ICE, Blocks.IRON_BLOCK, Blocks.IRON_ORE, Blocks.LAPIS_BLOCK, Blocks.LAPIS_ORE, Blocks.LIT_REDSTONE_ORE, Blocks.MOSSY_COBBLESTONE, Blocks.NETHERRACK, Blocks.PACKED_ICE, Blocks.RAIL, Blocks.REDSTONE_ORE, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.STONE, Blocks.STONE_SLAB, Blocks.STONE_BUTTON, Blocks.STONE_PRESSURE_PLATE);
|
||||
|
||||
protected ItemPickaxe(Item.ToolMaterial material)
|
||||
{
|
||||
super(1.0F, -2.8F, material, EFFECTIVE_ON);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this Item can harvest the given Block
|
||||
*/
|
||||
public boolean canHarvestBlock(IBlockState blockIn)
|
||||
{
|
||||
Block block = blockIn.getBlock();
|
||||
|
||||
if (block == Blocks.OBSIDIAN)
|
||||
{
|
||||
return this.toolMaterial.getHarvestLevel() == 3;
|
||||
}
|
||||
else if (block != Blocks.DIAMOND_BLOCK && block != Blocks.DIAMOND_ORE)
|
||||
{
|
||||
if (block != Blocks.EMERALD_ORE && block != Blocks.EMERALD_BLOCK)
|
||||
{
|
||||
if (block != Blocks.GOLD_BLOCK && block != Blocks.GOLD_ORE)
|
||||
{
|
||||
if (block != Blocks.IRON_BLOCK && block != Blocks.IRON_ORE)
|
||||
{
|
||||
if (block != Blocks.LAPIS_BLOCK && block != Blocks.LAPIS_ORE)
|
||||
{
|
||||
if (block != Blocks.REDSTONE_ORE && block != Blocks.LIT_REDSTONE_ORE)
|
||||
{
|
||||
Material material = blockIn.getMaterial();
|
||||
|
||||
if (material == Material.ROCK)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (material == Material.IRON)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return material == Material.ANVIL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.toolMaterial.getHarvestLevel() >= 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.toolMaterial.getHarvestLevel() >= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.toolMaterial.getHarvestLevel() >= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.toolMaterial.getHarvestLevel() >= 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.toolMaterial.getHarvestLevel() >= 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.toolMaterial.getHarvestLevel() >= 2;
|
||||
}
|
||||
}
|
||||
|
||||
public float getDestroySpeed(ItemStack stack, IBlockState state)
|
||||
{
|
||||
Material material = state.getMaterial();
|
||||
return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getDestroySpeed(stack, state) : this.efficiency;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user