Hello everyone. my name is Jordan Pryor, I am kinda New to Coding in Minecraft Forge. So, If you are going to Use my Tutorials, Do not just Copy and Paste try to Understand My Comments on the Code if You are to use it.Also, Till I improve my own Skill I can only Do a Few Things So, I hope You enjoy These Few!
Unrelated Questions
(First 4 Questions Where from DarkHax's Post With my Answers)
1) What is Meta-Inf?
It is a directory in the jar (zip), that contains Meta information about what is in the Jar.
When you modify the jar after it's been built then the meta information is no longer accurate.
It's presence is an optimization, if it isn't there then java will scan through the jar and figure out what is in it.
2)What Is the Use of The Mod Folder?
If You have all the API(S) installed To minecraft.jar, You can then just used the Zip version of you mod from that folder in less you edited Base Classes( EX. a.class, aa.class or Anything Similar)!
3) What is a Base Class exactly?
A base Class is a class already In minecraft, Thats why we Use API(S) so, we will not have to edit base classes, because As all of us(Including me) Know Editing them Cause A lot of issues be it conflicts with other mods or trying to fix bugs!
4)What is Difference from The Forge API & Modloader?
Well there Are almost the Same, Except Forge has Unified code(SP & SMP Same files) & forge allows you to use infinite sprites, sprite sheets and more To allow More Flexibility on the modders end. If you are new to Modding, Try Forge!
5)What are Annotations(@Mod)?
Annotations are something in Java that has been Token advantage of by Forge, It basically allows for a Easier Modding. The Main thing I will Explain in this is the @Mod
This tells Forge that this Class is the Base Class for you mod, and With it Requires some Extra work.
Example modid(String) = Give the unique Mod Id that forge use for Behind the scenes, I will get more in-Depth Later on.
Basic Template
package com.Tut.Tutorial;
//Import(S)
//Mod Info
@Mod(modid = "YourName_ModName", name = "Mod Name", version = "Mod Version")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class MODNAME {
@Instance("YourName_ModName")
public static MODNAME instance;
//Here you put your public Static(S) or Static(S)
@Init
public void Init(FMLInitializationEvent event)
{
//Here you put Block & Item Input(S), And register Everthing
}
//The Code here add a system output to get the Mod name in the loading, So you can Remove it
@cpw.mods.fml.common.Mod.PreInit
public void PreInit(FMLPreInitializationEvent event){
System.out.println("ModName Loaded!");
}
}
//Any Errors, Just try to Import The Need Src/File, or Email Me at [email protected]
MCP Set-Up
Setup
*Note* You can Just Download Forge's Source and Run the Install.bat it will download MCP for you 1)First Off You have to Download MCP(7.X for 1.4.6 http://www.mediafire...4kzs5swcm5ypqo6)
2)Next If you are Going to Use Forge, You have to Download its Source(Forge 6.5.0 for 1.4.6 http://www.minecraft...ic,4175.0.html)
3)Forge Requires the Server To Install(MC 1.4.6 https://s3.amazonaws...raft_server.jar)
4)Edited Your Jar? If so Force Update
5)Create a Folder To House Your MCP(Modding or ModName), For this It will Be MCP.
6)now Extract the Zip For MCP(Currently Mcp725.zip) To the Folder
7)Place Your Server Jar(minecraft_server.jar) in to MCP/jars Folder
8)Place the bin Folder from Your .minecraft Folder in to MCP/jars Folder
9)Place the resources Folder from Your .minecraft Folder in to MCP/jars Folder
10)Extract the Forge Folder from the Forge Source in to The MCP Folder
11)Now in the Forge Folder there should Be a install.bat/sh(SH for I belive Mac and Linux) now Click it and There you go You have set up Forge For Minecraft 1.4.6
Basic Block
Base Mod File
package com.tut.tutorial;
//Import(S)
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.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
//Mod Info
@Mod(modid = "JordanPryor_TUT", name = "TUT", version = "0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class BasicBlock {
@Instance
public static BasicBlock instance;
//Block Static(S)
public static Block BasicBlock;
@Init
public void Init(FMLInitializationEvent event)
{
//Block Inputs(Here you can Put the Properties here of the Block you are Making examples of Properties are Resistance, Hardness, & Light Value)
BasicBlock = new BlockBasic(251).setResistance(4F).setBlockName("basicblock").setCreativeTab(CreativeTabs.tabBlock);
//Game Registry(Blocks Only) This adds the Block to the game, With out this block will not show up
GameRegistry.registerBlock(BasicBlock);
//Language Registry(Blocks And Items) You have to do this To Have the name on the item
LanguageRegistry.addName(BasicBlock, "Block Basic");
}
}
//Note Email Me with Any Issues @ [email protected]
Block File
package com.tut.tutorial;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
public class BlockBasic extends Block
{
public BlockBasic(int blockID)
{
super(blockID, Material.rock);
blockIndexInTexture = 0;//The Location of the Texture on the Sprite Sheet(0-256)
setBlockName("Basic Block");
}
@Override
public String getTextureFile()
{
return "/TUT/Terrian/Terrian.png";//Location Of the Texture File, In this Case The Terrian.png
}
}
Basic Item
Base File
package com.tut.tutorial;
//Import(S)
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.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.item.Item;
import net.minecraft.creativetab.CreativeTabs;
//Mod Info
@Mod(modid = "JordanPryor_TUT", name = "TUT", version = "0.1")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class BasicItem {
@Instance
public static BasicItem instance;
//Item Static(S) - Basicaly Variables
public static Item BasicItem;
@Init
public void Init(FMLInitializationEvent event)
{
//Item Inputs(You Set up ID, Texture Location(0-256), Set Name, and Set Creative Tab )
itemBasic = new ItemBasic(8001).setIconIndex(0).setItemName("itemBasic").setCreativeTab(CreativeTabs.tabMaterials);
//Language Registry(Blocks And Items) You have to do this To Have the name on the item or Block
LanguageRegistry.addName(BasicItem, "Item Basic");
}
}
//Note Email Me with Any Issues @ [email protected]
Item File
package com.tut.tutorial;
import net.minecraft.item.Item;
public class ItemBasic extends Item
{
public ItemBasic(int i)
{
//Info On Properties
super(i);
maxStackSize = 64;
}
@Override
public String getTextureFile()
{
return "/TUT/GUI/allitems.png";//Texture File Location
}
}
When you modify the jar after it's been built then the meta information is no longer accurate.
It's presence is an optimization, if it isn't there then java will scan through the jar and figure out what is in it.
MCP Set-Up
*Note* You can Just Download Forge's Source and Run the Install.bat it will download MCP for you
1)First Off You have to Download MCP(7.X for 1.4.6 http://www.mediafire...4kzs5swcm5ypqo6)
2)Next If you are Going to Use Forge, You have to Download its Source(Forge 6.5.0 for 1.4.6 http://www.minecraft...ic,4175.0.html)
3)Forge Requires the Server To Install(MC 1.4.6 https://s3.amazonaws...raft_server.jar)
4)Edited Your Jar? If so Force Update
5)Create a Folder To House Your MCP(Modding or ModName), For this It will Be MCP.
6)now Extract the Zip For MCP(Currently Mcp725.zip) To the Folder
7)Place Your Server Jar(minecraft_server.jar) in to MCP/jars Folder
8)Place the bin Folder from Your .minecraft Folder in to MCP/jars Folder
9)Place the resources Folder from Your .minecraft Folder in to MCP/jars Folder
10)Extract the Forge Folder from the Forge Source in to The MCP Folder
11)Now in the Forge Folder there should Be a install.bat/sh(SH for I belive Mac and Linux) now Click it and There you go You have set up Forge For Minecraft 1.4.6
Basic Block
Block File
Basic Item
Item File