Wuppy’s Minecraft Forge Modding Tutorials for 1.7: Creating your own mod

In this tutorial I will explain how to create your own custom mod. Creating your own mod is very easy in the standard setup. What you have to do is right click on the src/main/java folder and select New and Package which will open up a new window in which you will have to add the name of the folder structure you will be coding in. The name should be something similar to com.wuppy.tutorial. Of course changing wuppy to a name you want and tutorial to the name of your mod. Then hit ok and Eclipse will create the folders in which you can store write your own mod.

When you have made the package right click it and select New Class. The class you will make now will, at the start, be the same as the ExampleMod, but with a changed class name and package name. However, in following tutorials a lot of code will be added to the file. It is also one of the most important files in your mod so make sure you use a good name such as Tutorial in the case of a mod called Tutorial. Once you click finish you should see a file that looks like this.

Next up go to the ExampleMod file and copy over all of the code. You will now have a ton of errors in the file. To fix the one under the package select Change package declaration when hovering over it. Also change the ExampleMod in your @Mod line and class line to the class name you just made. Your file should now look something like this.

There is one little change you should make. Change the MODID into whatever the name of your mod is. However, be sure to keep it lower case. For the tutorial the MODID will be tutorial. I will also remove the code in the Init method, because we won’t be using that in the actual mod. The file should then look like this.

In the next tutorial I will show you how to add a recipe to the game. However, there are multiple other tutorial you may want to follow as well. The mcmod.info tutorial which is about a file that is very important for a good mod, the Forge update tutorial, which you will be doing quite often, the mod release tutorial even though there is not that much to release just yet or one of the Eclipse improvements and tricks tutorials which may improve your coding experience.

 

For a more detailed explanation and much more, check out my book Sams Teach Yourself Mod Development for Minecraft in 24 Hours.

STY Minecraft Mod Development Book

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">