Java Code Examples for net.minecraft.item.Item.ToolMaterial#getHarvestLevel()
The following examples show how to use
net.minecraft.item.Item.ToolMaterial#getHarvestLevel() .
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 |
@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: ComponentMining.java From Artifacts with MIT License | 5 votes |
@Override public int getHarvestLevel(ItemStack stack, String toolClass) { ToolMaterial toolMaterial = ToolMaterial.values()[stack.stackTagCompound.getInteger("material")]; if(toolClass.equals("pickaxe")) { return toolMaterial.getHarvestLevel(); } else { return -1; } }
Example 3
Source File: ComponentExcavation.java From Artifacts with MIT License | 5 votes |
@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: ComponentExcavation.java From Artifacts with MIT License | 5 votes |
@Override public int getHarvestLevel(ItemStack stack, String toolClass) { ToolMaterial toolMaterial = ToolMaterial.values()[stack.stackTagCompound.getInteger("material")]; if(toolClass.equals("pickaxe") || toolClass.equals("shovel")) { return toolMaterial.getHarvestLevel(); } else { return -1; } }
Example 5
Source File: ComponentHarvesting.java From Artifacts with MIT License | 5 votes |
@Override public int getHarvestLevel(ItemStack stack, String toolClass) { ToolMaterial toolMaterial = ToolMaterial.values()[stack.stackTagCompound.getInteger("material")]; if(toolClass.equals("pickaxe")) { return toolMaterial.getHarvestLevel(); } return -1; }