O'Reilly logo

Minecraft™ Mod Development in 24 Hours, Sams Teach Yourself by Jimmy Koene

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Pickaxe

Now that you have a ToolMaterial, it is time to use it in a tool.

The Mod File Code

To add a tool to the mod file, add the following code to the mod file:

public static Item sampickaxe; ToolMaterial samium = EnumHelper.addToolMaterial("samium", 3, 1000, 9.5F, 3.5F, 10);

Additionally, add the following code to the preInit method:

sampickaxe = new ItemSamPickaxe(samium, "sampickaxe");GameRegistry.registerItem(sampickaxe, "SamPickaxe");

All of this code should be familiar to you at this point. The only thing that stands out is that the ItemSamPickaxe has the ToolMaterial as its first parameter. This is required for creating tools because of the file that will be extended ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required