Name and Version
Now that you have your project in Eclipse, you'll need to do a few things. First of all, make sure you know where Eclipse is looking for the files, particularly if you copied the Forge source directory during the import process. If you don't know what I'm talking about, read my previous post.
You will notice that you have at the top of your package explorer the source for a very basic mod, ExampleMod. Within the ExampleMod.java file you will see that there is a place for entering a MODID and a VERSION. Update those values to something unique to you. No sense in cluttering up the world with mods named ExampleMod. You should also rename the Java class to reflect the name you chose, and put it in a package that is unique to you.
Once you've done that, you are almost ready to test and then build. You'll also need to change the mcmod.info file in your src/main/resources directory. Make sure the modid in this file matches the one you put into your Java source.
Do a test run
Now it should be ready to do a quick test run. The big thing here is making sure you use the Client run configuration. It should either be called Client or Run Client, or some other similar name you chose during setup. To make sure you do it right the first time, go to the Run menu, choose Run Configurations, select the Run Client (or whatever) configuration under Java Application, and press the Run button. Here's a screenshot if you are a more visual person:
This should wind up starting Minecraft, with Forge, and if you check out the mods that are loaded, yours will be there.
As long as all this works, you are ready to actually build the JAR with your mod. This isn't tricky either, thanks to the magical tools provided by the Forge team.
Build your mod
Get to a command prompt and change to the root directory of your project. Type gradlew build and hit Enter. If all is well, you should see some lines of text popping out, at the end of which will be "BUILD SUCCESSFUL".
Check in the directory build\libs and you will find there your mod, in a file named modid.jar, with the name of course being the value you chose for MODID earlier.
Install and test
Now that you have your JAR file, you can copy it into your Minecraft mods directory, fire up Minecraft, and try playing! It doesn't actually do anything useful or fun just yet, but you have at this point validated that your tools are up and running, and all you have left to do is the trivial task of coding a useful mod. Stay tuned as we explore the wild and woolly world of mod coding!

No comments:
Post a Comment