Minecraft Blogs / Tutorial

How to make a Minecraft Mod / Ep.3 Basic Mod File / Modding Tutorial Series

  • 628 views, 1 today
  • 4
  • 1
TeamJaval's Avatar TeamJaval
Level 59 : Grandmaster Programmer
113
Hello and welcome back the the 3rd "How to make a Minecraft mod" tutorial by TeamJaval

In this tutorial we will be looking at making a basic mod file, which will be used for everything else in your mod.


Let's get straight into it!

Next tutorial: Click Here
Index Tutorial: Click Here

undefined

After the last tutorials, you should have setup forge, the debugger and should have eclipse open, now we can get into the actual coding.

First off you must click the little arrow next to the ONLY project "Minecraft". (In the topish left corner of the eclipse window)

Then on the arrow next to src/main/java.
In there, you should see a package called com.example.examplemod
You can look in there if you want but normally you don't have to as it is no use to what we will be doing in later tutorials.

Now right click on src/main/java and click "New" then "Package".
A new window should pop up looking something like this:


Spoiler
undefined



For the package name you can type in something like this: "com.yourusername.modname"



Click "Finish" and now that should be done!
Now right click on the package you just created and click "New" and then "Class".

A window should pop up looking like this:


Spoiler
undefined







Name it your mod name with no spaces. (e.g. "TutorialMod")

Now click "Finish".
Eclipse should now look something like this:


Spoiler
undefined



This will be where you put alot of your mod code, although some of it will be in seperate classes.

Now, above the "public class YourModName {" line put this code:




Spoiler
@Mod(modid="yourmodnamewithnocaseorspaces", name="Your Mod Name", version = "0.1")



Now there will be some errors, you can fix this by pressing Ctrl + Shift + O.



That will "import" all the neccecary classes.

Now your code should look like this:


Spoiler
undefined



Now below the "public class TutorialMod {" line you must put in this code:




Spoiler


@EventHandler
public void load(FMLPreInitializationEvent event)



{




}


Once again press Ctrl + Shift + O.

Your code should look something like this:


Spoiler
undefined

Now you should be able to click the little green bug at the top of the window and in the mods list, there will be your mod!

undefined


That is all for this tutorial and I will see you all in the next tutorial!

To create these tutorials for you is quite a challenge, If 
you'd like to see more tutorials and more sections covered then please 
donate to our team as generously as you can. Every bit of it helps and 
supports us even more.


undefined

Donators will be able to get private lessons from myself or anyone else from TeamJavalIncluding their name posted on numerous blogs as a big thank you.

undefined

undefined
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome