Minecraft 1.12 modding with forge – 12 – Custom Tools

Hello everyone! In this part I’ll show you how to make custom tools, I will show the normal tools and how to make a multi tool.

I’ll create a new package inside the item package called tools, just to keep the sourcecode ordered.
Now you have to create a new class for every type of tool. I’ll call them ItemCustomTOOLTYPE. (For example ItemCustomAxe).

Now you need to make the class extend the vanilla tool. So for the axe I’ll extend ItemAxe. Eclipse will complain because we need to add a constructor. For the axe we need to  add a constructor that takes a String for the name, a Toolmaterial, a float for the damage and another float for the speed. The other tools’ constructors can just take a String for the name and a Toolmaterial. In the constructor set the registryName and unlocalizedName. Here is the completed class for the pickaxe:

Now we need to create a ToolMaterial, this is used to determine how good the tool is. A ToolMaterial has:

  • A name (String)
    • This should be the same as the variable name.
  • A harvestLevel (int)
    • Which blocks are mineable. Vanilla blocks range between 0 and 3.
      • Wood: 0
      • Stone: 1
      • Iron: 2
      • Diamond: 3
      • Gold: 0
  • The max durability (int)
    • How many times the tool can be used.
      • Wood: 59
      • Stond: 131
      • Iron: 250
      • Diamond: 1561
      • Gold: 32
  • The mining speed (float)
    • How fast the tool is.
      • No tool: 1.0f
      • Wood: 2.0f
      • Stone: 4.0f
      • Iron: 6.0f
      • Diamond: 8.0f
      • Gold: 12.0f
  • The damage (float)
    • How much damage it does against entities.
      • Wood: 0.0f
      • Stone: 1.0f
      • Iron: 2.0f
      • Diamond: 3.0f
      • Gold: 0.0f
  • The enchantability (int)
    • How good the enchants are.
      • Wood: 15
      • Stone: 5
      • Iron: 14
      • Diamond: 10
      • Gold: 22

To add a new ToolMaterial we need to add a public static final variable of type ToolMaterial, I will call it TUTORIALMATERIAL in the ModItems class. To instantiate it we need to use the EnumHelper class added by forge. Call EnumHelper.addToolMaterial(name, harvestLevel, maxUses, efficiency, damage, enchantability), with the values you want. This is what I will use:

public static final ToolMaterial TUTORIALMATERIAL = EnumHelper.addToolMaterial("TUTORIALMATERIAL", 3, 2048, 13f, 4.0f, 30);

Now add variables for every tool you want to add. I will add every type so I will add 5 variables:

 static Item tutorialPickaxe;
 static Item tutorialAxe;
 static Item tutorialSpade;
 static Item tutorialHoe;
 static Item tutorialSword;

Now instantiate them with a name (I’ll use tutorial_tooltype) and the material we made, the axe you have to pass a damage and speed value, the vanilla values are:

  • Damage:
    • Wood/Gold: 6.0f
    • Stone/Iron/Diamond: 8.0f
  • Speed:
    • Wood/Stone: -3.2f
    • Iron: -3.1f
    • Diamond/Gold: -3.0f

I’ll use: 9.0f and -2.8f.
Now just register the tools like other items.

For the textures I used these: 

For the model file I used this:

Now we have some basic tools, but we can ofcourse also make a multi-tool, a tool that is multiple tools in one item. As an example I’ll make a pickAXE. A pickaxe and axe combined.
We’ll start by creating a new class in the tools package, I’ll call it ItemPickaxeAxe.
We have to choose which base tool we will extend, you should choose the tool which breaks the most blocks. I’ll extend a pickaxe in this case. The constructor is exactly the same as in the other tools.
We need to make a variable which tells which other blocks it can mine, this is the reason we want to extend the item which breaks the most amount of blocks. You can go into the vanilla tool classes and copy the EFFECTIVE_ON variable of the tool you want.

private static final Set<Block> EFFECTIVE_ON = Sets.newHashSet(Blocks.PLANKS, Blocks.BOOKSHELF, Blocks.LOG, Blocks.LOG2, Blocks.CHEST, Blocks.PUMPKIN, Blocks.LIT_PUMPKIN, Blocks.MELON_BLOCK, Blocks.LADDER, Blocks.WOODEN_BUTTON, Blocks.WOODEN_PRESSURE_PLATE);

We then need to override 3 methods:

  • Set<String> getToolClasses(ItemStack)
    • Ofcourse you need to replace pickaxe and axe with the tools you want.
      public Set<String> getToolClasses(ItemStack stack) {
      return ImmutableSet.of("pickaxe", "axe");
  • boolean canHarvestBlock(IBlockState)
    • Here we just need to check whether the EFFECTIVE_ON variable contains the block or whether the tool we extended can harvest this block.
      public boolean canHarvestBlock(IBlockState block) {
      return EFFECTIVE_ON.contains(block.getBlock()) ? true : super.canHarvestBlock(block);
  • float getDestroySpeed(ItemStack, IBlockState)
    • Here we need to check again whether the EFFECTIVE_ON variable contains the block, but because this is gonna be an axe we also need to check whether the material is wood, plants or vines.
      public float getDestroySpeed(ItemStack stack, IBlockState state) {Material material = state.getMaterial();
      if( material == Material.WOOD && material == Material.PLANTS && material == Material.VINE) {
      return this.efficiency;
      return EFFECTIVE_ON.contains(state.getBlock()) ? this.efficiency : super.getDestroySpeed(stack, state);

Now you just have to create a variable, instantiate it and register it in the ModItems class, just like the other tools. The model file is also the same, and this is the texture I used: 

That was all for this part! I hope you learned something, as always if you have any question don’t hesitate to ask in the comments. Saw any errors? Please tell me!
Till next time!


Posted in Forge tutorial, Forge Tutorial 1.12.


Leave a Reply to Daniel Cancel reply

Your email address will not be published. Required fields are marked *