net.minecraft.item.Item.ToolMaterial Java Examples
The following examples show how to use
net.minecraft.item.Item.ToolMaterial.
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 | 6 votes |
@Override public float getDigSpeed(ItemStack itemStack, Block block, int meta) { ToolMaterial toolMaterial = ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")]; if(toolMaterial == toolMaterial.WOOD) { return (Items.wooden_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()); } else if(toolMaterial == toolMaterial.STONE) { return (Items.stone_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()); } else if(toolMaterial == toolMaterial.GOLD) { return (Items.golden_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()); } else if(toolMaterial == toolMaterial.IRON) { return (Items.iron_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()); } else if(toolMaterial == toolMaterial.EMERALD) { return (Items.diamond_pickaxe.getDigSpeed(itemStack, block, meta) / 2 * ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()); } return (toolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial()); }
Example #3
Source File: Materials.java From BaseMetals with GNU Lesser General Public License v2.1 | 6 votes |
protected static void registerMaterial(String name, MetalMaterial m){ allMaterials.put(name, m); String enumName = m.getEnumName(); String texName = m.getName(); int[] protection = m.getDamageReductionArray(); int durability = m.getArmorMaxDamageFactor(); ArmorMaterial am = EnumHelper.addArmorMaterial(enumName, texName, durability, protection, m.getEnchantability(), SoundEvents.ITEM_ARMOR_EQUIP_IRON, (m.hardness > 10 ? (int)(m.hardness / 5) : 0)); if(am == null){ // uh-oh FMLLog.severe("Failed to create armor material enum for "+m); } armorMaterialMap.put(m, am); FMLLog.info("Created armor material enum "+am); ToolMaterial tm = EnumHelper.addToolMaterial(enumName, m.getToolHarvestLevel(), m.getToolDurability(), m.getToolEfficiency(), m.getBaseAttackDamage(), m.getEnchantability()); if(tm == null){ // uh-oh FMLLog.severe("Failed to create tool material enum for "+m); } toolMaterialMap.put(m, tm); FMLLog.info("Created tool material enum "+tm); }
Example #4
Source File: TFCItems.java From TFC2 with GNU General Public License v3.0 | 6 votes |
public static void Load() { TFC.log.info(new StringBuilder().append("[TFC2] Loading Items").toString()); LooseRock = registerItemOnly(new ItemLooseRock().setUnlocalizedName("looserock")); Plank = registerItemOnly(new ItemPlank().setUnlocalizedName("plank")); StoneAxe = registerItem(new ItemAxe(ToolMaterial.STONE, 30).setUnlocalizedName("stone_axe")); StoneShovel = registerItem(new ItemShovel(ToolMaterial.STONE).setUnlocalizedName("stone_shovel")); StoneKnife = registerItem(new ItemKnife(ToolMaterial.STONE).setUnlocalizedName("stone_knife")); StoneHoe = registerItem(new ItemHoe(ToolMaterial.STONE).setUnlocalizedName("stone_hoe")); StoneHammer = registerItem(new ItemHoe(ToolMaterial.STONE).setUnlocalizedName("stone_hammer")); ToolHead = registerItemOnly(new ItemToolHead().setUnlocalizedName("tool_head")); Firestarter = registerItem(new ItemFirestarter().setUnlocalizedName("firestarter")); Straw = registerItem(new ItemTerra().setUnlocalizedName("straw").setCreativeTab(TFCTabs.TFCMaterials)); PotteryJug = registerItemOnly(new ItemPotteryJug().setUnlocalizedName("jug")); PotteryPot = registerItemOnly(new ItemPotteryPot().setUnlocalizedName("pot")); PotteryVessel = registerItemOnly(new ItemPotteryVessel().setUnlocalizedName("vessel")); PotteryMold = registerItemOnly(new ItemPotteryMold().setUnlocalizedName("mold")); PotteryBowl = registerItemOnly(new ItemPotteryBowl().setUnlocalizedName("bowl")); PotteryFireBrick = registerItemOnly(new ItemPotteryFireBrick().setUnlocalizedName("fire_brick")); }
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; }
Example #6
Source File: ComponentHarvesting.java From Artifacts with MIT License | 5 votes |
@Override public float getDigSpeed(ItemStack itemStack, Block block, int meta) { if (block != Blocks.coal_ore && block != Blocks.iron_ore && block != Blocks.emerald_ore && block != Blocks.gold_ore && block != Blocks.diamond_ore && block != Blocks.quartz_ore && block != Blocks.lapis_ore && block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore) { return -1; } else { return (ToolMaterial.values()[itemStack.stackTagCompound.getInteger("material")].getEfficiencyOnProperMaterial() / 2); //return 15; } }
Example #7
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 #8
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 #9
Source File: ComponentExcavation.java From Artifacts with MIT License | 5 votes |
@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 #10
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 #11
Source File: ItemMetalShovel.java From BaseMetals with GNU Lesser General Public License v2.1 | 4 votes |
public ToolMaterial getToolMaterial() { return this.toolMaterial; }
Example #12
Source File: ItemFakeSwordRenderable.java From Artifacts with MIT License | 4 votes |
public ItemFakeSwordRenderable(ToolMaterial toolMaterial, String str) { super(toolMaterial); regString = str; this.setCreativeTab(null); }
Example #13
Source File: ENItems.java From ExNihiloAdscensio with MIT License | 4 votes |
@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(); }
Example #14
Source File: ToolPL.java From Production-Line with MIT License | 4 votes |
private Sword(ToolMaterial toolMaterial, String name) { super(toolMaterial); registerItem(name, this); }
Example #15
Source File: ToolPL.java From Production-Line with MIT License | 4 votes |
private Spade(ToolMaterial toolMaterial, String name) { super(toolMaterial); registerItem(name, this); }
Example #16
Source File: ToolPL.java From Production-Line with MIT License | 4 votes |
private Axe(ToolMaterial toolMaterial, String name) { super(toolMaterial); registerItem(name, this); }
Example #17
Source File: ToolPL.java From Production-Line with MIT License | 4 votes |
private Pickaxe(ToolMaterial toolMaterial, String name) { super(toolMaterial); registerItem(name, this); }
Example #18
Source File: ToolPL.java From Production-Line with MIT License | 4 votes |
public static Item registerSword(ToolMaterial toolMaterial, String name) { return new Sword(toolMaterial, name); }
Example #19
Source File: ToolPL.java From Production-Line with MIT License | 4 votes |
public static Item registerSpade(ToolMaterial toolMaterial, String name) { return new Spade(toolMaterial, name); }
Example #20
Source File: ToolPL.java From Production-Line with MIT License | 4 votes |
public static Item registerAxe(ToolMaterial toolMaterial, String name) { return new Axe(toolMaterial, name); }
Example #21
Source File: ToolPL.java From Production-Line with MIT License | 4 votes |
public static Item registerPickaxe(ToolMaterial toolMaterial, String name) { return new Pickaxe(toolMaterial, name); }
Example #22
Source File: Materials.java From BaseMetals with GNU Lesser General Public License v2.1 | 2 votes |
/** * Gets the tool material for a given metal * @param m The metal of interest * @return The tool material for this metal, or null if there isn't one */ public static ToolMaterial getToolMaterialFor(MetalMaterial m){ return toolMaterialMap.get(m); }