(adsbygoogle = window.adsbygoogle || []).push({});Hey everybody! I recently got into Minecraft modding (or coding). I recently made a mod on generating more ores (saphire, emerald, etc...) and wanted to share some
of these mods with you in tutorial form ANYWHO, your going to need 3 things: Minecraft Coder Pack (which we will call MCP), Java SDK, and WinRar (or any other archiver)
. (I prefer Notepad ++ ). Don't have those? Follow this tutorial:
Step 1 - Download the Minecraft Coder Pack You must login or register to view this content. and Minecraft ModLoader You must login or register to view this content..
Step 2 - Create a new folder ANYWHERE WHERE YOU CAN ACCESS IT and call it "Minecraft Coder Pack" or "MCP".
Step 3 - Open the mcp44 (MCP) you downloaded with WinRAR and open ModLoader DON'T COPY MODLOADER YET..
Step 4 - COPY EVERYTHING in mcp44 into your Minecraft Coder Pack FOLDER. Then copy the ModLoader files. BUT DO NOT PASTE THEM ANYWHERE YET.
Step 5 - Go to Start > Run > %appdata% and look for a folder called .minecraft.
Step 6 - BACK THAT FOLDER UP. Once you have backed it up somewhere safe, delete it.
Step 7 - Open up Minecraft and update to the latest version. Start a Singleplayer level then save-and-quit.
Step 8 - Go to Start > Run > %appdata% and go to the folder .minecraft.
Step 9 - Open .minecraft and look for a folder called "bin". OPEN that.
Step 10 - Open the minecraft folder in the "bin" folder and paste in the Minecraft ModLoader that we copied earlier. Then exit out of the minecraft folder and copy your bin folder.
Step 11 - Open your Minecraft Coder Pack folder and locate a folder labled "jars". PASTE your bin folder in there.
Step 12 - Go to your main root of your Minecraft Coder Pack folder and locate decompile.bat (or it might just be decompile).
Step 13 - Double click decompile.bat and wait until it says "Press any key to continue..." or something similar to that. IF YOU GOT AN ERROR, YOU EITHER DID NOT SET YOUR
PATH UP RIGHT OR YOU DO NOT HAVE JAVA SDK INSTALLED. If it said "Could not locate minecraft_server.jar..." or something similar, it's ok. We're making singleplayer mods.
Step 14 - If you didn't get any errors, you can move onto the next page: Creating your first mod.
If you got errors, continue reading on.
Step 15 - Go to Start and RIGHT-CLICK COMPUTER and hit properties.
Step 16 - In the top left, click Advanced system settings. A window should pop up. Go to the advanced tab and click Environment Variables at the botom.
Step 17 - Under System variables, locate a variable called PATH or Path. Click it then click Edit.
Step 18 - Locate where you have Java JDK installed. Mine was C:\Program Files (x86)\Java\jdk1.7.0\bin. Just put yours in by clicking Start > Computer > Your hard drive > Program Files
(or Program Files (x86)) > Java > jdk#.#.# (# = your version [mine was 1.7.0]) > bin. Just write that down in PATH. MAKE SURE YOU PUT A ";" AT THE END OF WHATEVER WAS THERE
BEFORE YOU PASTED YOUR JDK. (i.e. I had Lally/Cocka/Pepe/Shier/Man just put a ";" at the end then paste in your JDK location).
Step 19 - Repeat steps 11 - 13.
[multipage=Making the Block]
Well, looks like you made it through installing MCP successfully. Now for the hard (easy) part!
Step 1 - Go to the main root of your MCP folder and locate a folder labled "src". Open that then open the folder minecraft then net then minecraft then src then your good.
Step 2 - You should be at src > minecraft > net > minecraft > src. This is where all the .java codes are written. I think. IDK. I just know this is where you make your mods!! Make a new
file called "mod_Lallyman"
Step 3 - Make sure it's a 100% blank. Also make sure it's a .java file, not .txt. Open it with a text viewer (again I use Notepad ++).
Step 4 - We're going to start with making a block called LallyBlock. So first, copy this template:
public String Version()
{
return "3.14159265";
}
}
Step 5 - Alright. Replace mod_base (both of them!) with mod_Lallyman.
Step 6 - Inbetween the { and public mod_Lallyman, copy this code:
public static final Block LallyBlock = new BlockLally(200,0).setHardness(1.5F).setResistance( 500.0F).setBlockName("Lallym").setLightValue(0.0F);
Step 7 - I'll try to go into as much detail as possible.
public static final Block LallyBlock: declaring a block (BlockLally) as LallyBlock. You could honestly call it MerkiiRocks or something.
new BlockLally(200,0): adding a new block with a Block ID of 200.
setHardness(1.5F): how hard the block is. 1.5 is cobblestone. 10 is obsedian.
setResistance(500.0F): how resistance this block is to TNT/Creepers.
setBlockName: what the game is going to recognize the block as.
setLightValue(0.0F): honestly not needed if the value is 0.0 but this is like a torch... how much light it produces.
Step 8 - Inbetween the two {} in public mod_Lallyman, paste this code in:
ModLoader.RegisterBlock(LallyBlock); //Registering a new block (LallyBlock) with the game
LallyBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/NGU<3.png"); //Where we add our picture/texture to the block. Will go into later
ModLoader.AddName(LallyBlock, "My NGU is LALLYMAN"); //What the block is going to say when you hover over it with your mouse.
Step 9 - Now we have to add a recipe for our block to test if it works. Use this code:
ModLoader.AddRecipe(new ItemStack(LallyBlock, 5), new Object[] {
"*", Character.valueOf('*', Block.dirt,
});
Basically saying your adding a crafting recipe out of 1 dirt and produce 5 of the LallyBlock.
Step 10 - Now that you have all that, this is what the final code should look like:
public class mod_Lallyman extends BaseMod
{
public static final Block LallyBlock = new BlockLally(198,0).setHardness(1.0F).setResistance( 500.0F).setBlockName("Lallym").setLightValue(0.0F);
public mod_Lallyman()
{
ModLoader.RegisterBlock(LallyBlock);
LallyBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/LallyBlock.png");
ModLoader.AddName(LallyBlock, "My NGU is LALLYMAN");
public class BlockLally extends Block
{
protected BlockLally(int i, int j)
{
super (i,j,Material.wood); //Material.wood is the material it will be (i.e. sound when you place it down or when you brake it you can get it with your hands).
}
public int idDropped(int i, Random random)
{
return Block.oreGold.blockID; //What your block will drop when it is broken.
}
public int quantityDropped(Random random)
{
return 15; // How much of the block it's dropping. Mine will drop 15 Gold ore.
}
}
Alright! Now all we have to do is add a texture and we're done![/multipage]
[multipage=Making the block (texture)]
I recomend using Paint.NET because it provides a 16x16 editor! I'm going to show a video tutorial on how to create your texture in Paint.NET. I will write out the rest.
Step 1 - Find where you have saved your block.r I saved mine in my pictures as LallyBlock because that's what it is declared as in mod_Lallyman.
Step 2 - Copy your block and then go to your MCP folder, bin, minecraft, and paste it in there.
Step 3 - We're all done!!
Finalizing your block
So now that you have made your block, it's time to test this out. Run recompile.bat and if you get errors, you input something wrong. Otherwise, it should say "Press and key
to continue...." So just click any key then run startclient.bat and load up a new minecraft world. Get 1 block of dirt and put it in a crafting table. There's our block!
Also, here's a video kind of showing how I make them in Paint.NET.