Java Code Examples for net.minecraft.item.Item.ToolMaterial#GOLD

The following examples show how to use net.minecraft.item.Item.ToolMaterial#GOLD . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComponentMining.java    From Artifacts with MIT License 6 votes vote down vote up
@Override
public boolean canHarvestBlock(Block block, ItemStack itemStack) {
	ToolMaterial toolMaterial = ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")];
	
	if(toolMaterial == toolMaterial.WOOD) {
		return Items.wooden_pickaxe.func_150897_b/*canHarvestBlock*/(block);
	}
	else if(toolMaterial == toolMaterial.STONE) {
		return Items.stone_pickaxe.func_150897_b(block);
	}
	else if(toolMaterial == ToolMaterial.EMERALD) {
		return Items.diamond_pickaxe.func_150897_b(block);
	}
	else if(toolMaterial == ToolMaterial.IRON) {
		return Items.iron_pickaxe.func_150897_b(block);
	}
	else if(toolMaterial == ToolMaterial.GOLD) {
		return Items.golden_pickaxe.func_150897_b(block);
	}
	return block == Blocks.obsidian ? toolMaterial.getHarvestLevel() == 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock ? true : (block.getMaterial() == Material.iron ? true : block.getMaterial() == Material.anvil)) : toolMaterial.getHarvestLevel() >= 2) : toolMaterial.getHarvestLevel() >= 1) : toolMaterial.getHarvestLevel() >= 1) : toolMaterial.getHarvestLevel() >= 2) : toolMaterial.getHarvestLevel() >= 2) : toolMaterial.getHarvestLevel() >= 2);
}
 
Example 2
Source File: ComponentExcavation.java    From Artifacts with MIT License 5 votes vote down vote up
@Override
public float getDigSpeed(ItemStack itemStack, Block block, int meta) {
	ToolMaterial toolMaterial = ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")];
	if(toolMaterial == ToolMaterial.WOOD) {
		//System.out.println("Wood " + Item.pickaxeWood.getStrVsBlock(par1ItemStack, par2Block));
		return Math.max((Items.wooden_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()) / 10,
				        (Items.wooden_shovel.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()) / 10);
	}
	else if(toolMaterial == ToolMaterial.STONE) {
		//System.out.println("Stone " + Item.pickaxeStone.getStrVsBlock(par1ItemStack, par2Block));
		return Math.max((Items.stone_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()) / 10,
				        (Items.stone_shovel.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()) / 10);
	}
	else if(toolMaterial == ToolMaterial.EMERALD) {
		//System.out.println("Diamond " + Item.pickaxeDiamond.getStrVsBlock(par1ItemStack, par2Block));
		return Math.max((Items.diamond_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()) / 10,
		                (Items.diamond_shovel.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()) / 10);
		}
	else if(toolMaterial == ToolMaterial.IRON) {
		//System.out.println("Iron " + Item.pickaxeIron.getStrVsBlock(par1ItemStack, par2Block));
		return Math.max((Items.iron_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()) / 10,
		                (Items.iron_shovel.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()) / 10);
		}
	else if(toolMaterial == ToolMaterial.GOLD) {
		//System.out.println("Gold " + Item.pickaxeGold.getStrVsBlock(par1ItemStack, par2Block));
		return Math.max((Items.golden_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()) / 10,
		                (Items.golden_shovel.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()) / 10);
		}
	return (ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()) / 10;
}
 
Example 3
Source File: ComponentExcavation.java    From Artifacts with MIT License 5 votes vote down vote up
@Override
public boolean canHarvestBlock(Block block, ItemStack itemStack) {
	ToolMaterial toolMaterial = ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")];
	
	try {
		if(block.getBlockHardness(null, 0, 0, 0) == -1) {
			return false;
		}
	}
	catch(NullPointerException e) {
		return false;
	}
	
	if(block.getMaterial().isToolNotRequired()) {
		return true;
	}
	
	if(toolMaterial == ToolMaterial.WOOD) {
		return Items.wooden_pickaxe.func_150897_b/*canHarvestBlock*/(block) || Items.wooden_shovel.func_150897_b(block);
	}
	else if(toolMaterial == ToolMaterial.STONE) {
		return Items.stone_pickaxe.func_150897_b(block) || Items.stone_shovel.func_150897_b(block);
	}
	else if(toolMaterial == ToolMaterial.EMERALD) {
		return Items.diamond_pickaxe.func_150897_b(block) || Items.diamond_shovel.func_150897_b(block);
	}
	else if(toolMaterial == ToolMaterial.IRON) {
		return Items.iron_pickaxe.func_150897_b(block) || Items.iron_shovel.func_150897_b(block);
	}
	else if(toolMaterial == ToolMaterial.GOLD) {
		return Items.golden_pickaxe.func_150897_b(block) || Items.golden_shovel.func_150897_b(block);
	}

	return toolMaterial.getHarvestLevel() >= block.getHarvestLevel(0);
}
 
Example 4
Source File: ENItems.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
@SuppressWarnings("deprecation")
   public static void init()
{
	hammerWood = new HammerBase("hammerWood", 64, ToolMaterial.WOOD);
	hammerWood.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	
	hammerStone = new HammerBase("hammerStone", 128, ToolMaterial.STONE);
	hammerStone.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	
	hammerIron = new HammerBase("hammerIron", 512, ToolMaterial.IRON);
	hammerIron.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	
	hammerDiamond = new HammerBase("hammerDiamond", 4096, ToolMaterial.DIAMOND);
	hammerDiamond.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	
	hammerGold = new HammerBase("hammerGold", 64, ToolMaterial.GOLD);
	hammerGold.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	
	crookWood = new CrookBase("crookWood", 64);
	crookWood.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	
	crookBone = new CrookBase("crookBone", 256);
	crookBone.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	
	mesh = new ItemMesh();
	mesh.setCreativeTab(ExNihiloAdscensio.tabExNihilo);
	
	resources = new ItemResource();
	OreDictionary.registerOre("clayPorcelain", ItemResource.getResourceStack("porcelain_clay"));
	
	cookedSilkworm = new ItemCookedSilkworm();

       pebbles = new ItemPebble();
	
	itemSeeds.add(new ItemSeedBase("oak", Blocks.SAPLING.getStateFromMeta(0)));
	itemSeeds.add(new ItemSeedBase("spruce", Blocks.SAPLING.getStateFromMeta(1)));
	itemSeeds.add(new ItemSeedBase("birch", Blocks.SAPLING.getStateFromMeta(2)));
	itemSeeds.add(new ItemSeedBase("jungle", Blocks.SAPLING.getStateFromMeta(3)));
       itemSeeds.add(new ItemSeedBase("acacia", Blocks.SAPLING.getStateFromMeta(4)));
       itemSeeds.add(new ItemSeedBase("darkOak", Blocks.SAPLING.getStateFromMeta(5)));
	itemSeeds.add(new ItemSeedBase("cactus", Blocks.CACTUS.getDefaultState()).setPlantType(EnumPlantType.Desert));
	itemSeeds.add(new ItemSeedBase("sugarcane", Blocks.REEDS.getDefaultState()).setPlantType(EnumPlantType.Beach));
	itemSeeds.add(new ItemSeedBase("carrot", Blocks.CARROTS.getDefaultState()).setPlantType(EnumPlantType.Crop));
	itemSeeds.add(new ItemSeedBase("potato", Blocks.POTATOES.getDefaultState()).setPlantType(EnumPlantType.Crop));
	
	dolls = new ItemDoll();
	
}