Setting up your main mod class
Page 1 of 1
Setting up your main mod class
Here's where the coding begins.
So, on the left hand side of the screen there is a package explorer, open up the file that says Minecraft.
Open src/main/java.
And then delete the package that is called 'com.example.examplemod' YOU DON'T NEED IT!
Now what you need to do is left-click on the folder again and create a new package (either right click or it'll say at the top).
To name this package, type your minecraft username, full stop, and then the name of your mod (eg. xxmlglad420xx.mlgmod).
In this package make a new Java class (again right click or look at the top).
Call this class 'Main' or the name of your mod.
Now that you have a class - it's time to add some code to it. Now I won't tell you what to type letter by letter - just copy from this template and edit what needs to be edited (mod names - versions and Id's).
So the mod version is how many versions of the mod there is,
the mod id is, for example, if you were using the command : /give @a minecraft:diamond 64, to do it with and item from your mod
you would do : /give @a modid:sniper 420, also the mod id is needed for the coding itself later on.
So there's ya mod class. Everything from rendering items and blocks to rendering entities and much more go in here.
Anyway, I'm tired now so I'll add another tutorial on here tomorrow or what ever (if you're reading this at 4 or 5pm, it should be up).
I'll be showing you how to add an item to the game.
Any problems, just ask.
So, on the left hand side of the screen there is a package explorer, open up the file that says Minecraft.
Open src/main/java.
And then delete the package that is called 'com.example.examplemod' YOU DON'T NEED IT!
Now what you need to do is left-click on the folder again and create a new package (either right click or it'll say at the top).
To name this package, type your minecraft username, full stop, and then the name of your mod (eg. xxmlglad420xx.mlgmod).
In this package make a new Java class (again right click or look at the top).
Call this class 'Main' or the name of your mod.
Now that you have a class - it's time to add some code to it. Now I won't tell you what to type letter by letter - just copy from this template and edit what needs to be edited (mod names - versions and Id's).
- Code:
package xxmlglad420xx.mlgmod;
import net.minecraft.init.Blocks;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@Mod(modid = Tutorial.MODID, version = Tutorial.VERSION)
public class Tutorial
{
public static final String MODID = "tutorial";
public static final String VERSION = "1.0";
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
}
@EventHandler
public void init(FMLInitializationEvent event)
{
}
@EventHandler
public void psotInit(FMLPostInitializationEvent event)
{
}
}
So the mod version is how many versions of the mod there is,
the mod id is, for example, if you were using the command : /give @a minecraft:diamond 64, to do it with and item from your mod
you would do : /give @a modid:sniper 420, also the mod id is needed for the coding itself later on.
So there's ya mod class. Everything from rendering items and blocks to rendering entities and much more go in here.
Anyway, I'm tired now so I'll add another tutorial on here tomorrow or what ever (if you're reading this at 4 or 5pm, it should be up).
I'll be showing you how to add an item to the game.
Any problems, just ask.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum