Hello and, finally, welcome back to the long overdue third tutorial in my Modding with Forge series. It's only taken me 7 months to get around to this tutorial, so I really hope that the series restarts with a bang!
In the previous two tutorials, we have looked at how to set up Eclipse, Forge and Gradle and now have all three working in collaboration with each other. For anybody who is struggling with setting up Minecraft Forge, especially version 1.7.10, take a look through the previous two tutorials again, since I have added some little pointers throughout the tutorial that explain how I have set it up with 1.7.10 to get it working, since some things, though not many, are a little bit different.
Now, instead of boring you with the basics of setting up your mod structure, which I am sure you already know how to do, I have pre-coded the required code for this tutorial, which can be found here (Episode 3 startup). If there is anything you don't understand about this code, look back at my tutorials for 1.6.4 and, if you are still confused after this, let me know in the comments below and I'll explain it as best as I can.
Now, the next thing we need to do is actually get the code to work properly. You may have noticed that, when typing out (or copying) my source code, that you may get some import errors. The reason for this (if you are experiencing them) is because your project does not know it should be using Forge as a dependency.
Okay, so what the h**l am I talking about? Your project needs a dependency project... What? Well, currently, your eclipse should look like this. To fix the dependency issues and, then, the import issues, you want to right click on your project (mine is called "MCForums"). Right at the bottom, there is an option called "Properties"; click on that and it will open this view. Go to the option called "Java Build Path" and then, at the top of the view, select "Projects". Currently, the view should be empty. Select "Add..." on the right and then tick the Forge project. Press "OK" twice, so that both the windows close.
Now, if you go into the "Tutorial" class file, or wherever your import errors are occurring, press 'Ctrl' ('Command' on Mac), 'Shift' and 'O'. You should now have 4 imports:
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
This is the basics of your mod file; the empty skeleton that we will fill with our content.
If you are having any troubles with the build.gradle file from the last tutorial, feel free to check mine out at the BitBucket page (linked at the start of this tutorial). If you don't understand anything that I have explained in this tutorial, please take a look at the 1.6.x tutorials that I have written (there is an in-depth one explaining everything we have just done here) before commenting below.
End of Tutorial
This is the end of Modding with Forge #3 - The Basics of 1.7.x Mod Creation. Although this tutorial has been short, I hope that it indicates a return to the Forums and will keep my progress with these tutorials going. We have set up the skeleton of our 1.7.x mod in this tutorial and, in the next one, we will take a look at setting up custom items and blocks with the new 1.7.x code.
If you have liked the way I have delivered this tutorial (providing a base code for you to look at and then explained it), please let me know below and I will continue to do so for future tutorials. It should also make it easier to understand anything that I don't fully explain or explain in a complicated way.
If you have suggestions for tutorial content, please let me know, either in the comments below or by sending me a PM. With the new forum setup, I will be notified either way.
I hope you have enjoyed this tutorial and I am glad to be back to the forums.
I'll see you in the next one.
View the previous tutorial (Tutorial #2 - Exporting our Mod)
View the next tutorial (Tutorial #3b - An Empty Mod File (and Hard-Coding mcmod.info))