Hello, well I started making tutorials along time ago. But I never finished making them, or I never even started making any. Either way I am starting again, and determined to finish all of them that I start. For now I will upload a tutorial everyday possibly, but if you wanna make a request please either; Message me on MC forums, Request one via IRC (#MinecraftForgeTuts), or post below. These tutorials will come along a first come-first serve basis. Anyways here are the tutorials:
@Mod class base:
package asyncronous.tutorial; // Package declaration
// ------------------- Imports -------------------------
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.Mod.ServerStarted;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
// -------------------------------------------------------
@Mod(modid="TM", name="Tutorial Mod", version="0")
// This part (Above) is required to allow your class to be tagged by the forge class
// loader as a mod, so it can parse the meta-data inside the class.
public class TutorialMod{
@Instance("TM") // This is the annotation to notify forge upon loading the class, to set the instance.
public static TutorialMod instance; // this is your instance of your mod, this will be used more in the future.
@PreInit()
public void preInit(FMLPreInitializationEvent event){
// This is the Pre-Initialization Method, which is parsed by forge in the class loader.
// This has nothing yet, but it will contain some important things later on when making more complex mods.
}
@Init()
public void init(FMLInitializationEvent event){
// This is the Initialization Method, which again will be parsed by forge in the class loader.
// This again will have nothing yet, will contain most of your load code for your mod later on.
}
@ServerStarted()
public void serverStarted(FMLServerStartedEvent event){
// This method is the ServerStarted method.
// This method allows you to register commands like the /give command. and others that you make yourself.
}
}
First Block:
TutorialBlock.class:
package asyncronous.tutorial.blocks;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
// This is just a basic block, make sure the class extends Block
public class BlockTutorial extends Block{
public BlockTutorial(int id){
super(id, 0, Material.rock); // The first param is the ID, the second is the Texture index, the third is the Material of the Block.
this.setCreativeTab(CreativeTabs.tabBlock); // This is where you set the creative tab you want the block to be displayed on.
this.setHardness(5.0F); // This is the hardness, its in Float format (x.xF)
this.setResistance(1.0F); // This is the resistance, its again in Float format (x.xF)
this.setBlockName("blockTutorialBlock"); // This is the blocks reference name in String format ("")
}
@Override
public int idDropped(int i, Random rand, int j){
return this.blockID; // You could return this, or a Block / Item reference.
}
@Override
public int quantityDropped(int i, int j, Random rand){
return 1; // This is where you return the amount of Items / Blocks returned, when dropped.
}
}
@Mod
package asyncronous.tutorial;
import net.minecraft.block.Block;
import asyncronous.tutorial.blocks.BlockTutorial;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.Mod.ServerStarted;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid="TM", name="Tutorial Mod", version="0")
public class TutorialMod{
private static Block blockTutorial = new BlockTutorial(3000); // This is the instance of the BlockTutorial class.
@Instance("TM")
public static TutorialMod instance;
@PreInit()
public void preInit(FMLPreInitializationEvent event){
}
@Init()
public void init(FMLInitializationEvent event){
GameRegistry.registerBlock(blockTutorial, "blockTutorial"); // This is where you register The block.
LanguageRegistry.addName(blockTutorial, "Tutorial Block"); // This is where you give the block that you registered a name.
}
@ServerStarted()
public void serverStarted(FMLServerStartedEvent event){
}
@Mod class base:
First Block:
TutorialBlock.class:
@Mod
First Item:
Withheld till finished.
Proxies:
Ticking:
Events: