Hi guys I am TheMinecraftModder98 and this is my very first tutorial and post so please don't be too rough on me... If you want you can check me out on Youtube at: TheMinecraftModder98
My E-Mail address is: [email protected]
The first thing you want to do is make a new class called mod_Namhere.java (make sure it ends in .java It Is VERY IMPORTANT!)(mine will be mod_Emeralds) and then add the code below (The code below will be s starter for all mods you make)
Add This Code:
package net.minecraft.src;
public class mod_Emeralds extends BaseMod
{
public mod_Emeralds()
{
}
public String Version()
{
return "Emeralds Mod Alpha 1.0";
}
}
Ok that is your base structure for the mod (and pretty much every mod you make)
Now we can get started adding the real stuff :smile.gif:
Next Code:(Add directly above "public mod_Emeralds()"
public static final Block emeraldOre = new BlockEmeraldOre(150, 0).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("emeraldOre");
If you are using Eclipse you will get an error because we still need to create a new class, but if your not using Eclipse just sit tight. In this code "public static final Block emeraldOre" is declaring our new block which Minecraft will refer to as emeraldOre. Next, "(150, 0)" The 150 is the ID number of the block (always start with 150 and go up to be safe).The 0 is the texture and we need to keep it 0 for now. The ".setHardness" is how hard the block will be to break (how long it will take) and the 3F is the basic number for an Ore Block in Minecraft. If you want you can change it but keep the F at the end (ex. 5F). The ".setStepSound" just says what your block will sound like when walked on. This can be changed by replacing "Block.soundStoneFootstep" with Block.soundSandFootstep or almost any other block. Finally, the ".setBlockName" just tells Minecraft what name to refer to (this will not be the in-game name!). So now that we are finished with that we go on to the next code.
Ok so now we have "ModLoader.RegisterBlock(emeraldOre);", which just tells ModLoader to register this block with the rest of the blocks. Next is "ModLoader.AddName" , the first name is the original name you gave it which was "emeraldOre" and the second name is the in-game name you are giving your block (mine is "Emerald Ore").And finally we have "emeraldOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Emeralds/emerald-ore.png");", which adds you texture. The first part, "("/terrain.png" is the image you are overwriting (use this for all blocks) and the second part, "/Emeralds/emerald-ore.png" is the image you are overwriting it with. The first part in that, "/Emeralds" is the folder the image will be located in. The last part, "emerald-ore.png" is the name of the image in that folder. Once you get your image folder place that in the folder called minecraft found by clicking Temp, Bin, then Minecraft.Now that class is done we need our BlockEmeraldOre.java class. So after you create that type the following:
Code:
package net.minecraft.src;
public class BlockEmeraldOre extends Block
{
public BlockEmeraldOre(int i, int j)
{
super(i, j, Material.iron);
}
}
Now the only part you guys need to know on this is the "Material.iron" part. If you look on google at minecraft materials you might find other things you can use.
Now you are finished! All you need to do is recompile and you should have no errors, because i don't. After recompiling take the .class files found in the reobf folder and put them in your minecraft.jar folder along with your block texture folder and modloader.If you need a video tutorial on doing this part just ask and i will be more than happy to.
Congratulations! You have your first block
Finished Codes:
mod_Emeralds.java
package net.minecraft.src;
public class mod_Emeralds extends BaseMod
{
public static final Block emeraldOre = new BlockEmeraldOre(150, 0).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("emeraldOre");
public mod_Emeralds()
{
ModLoader.RegisterBlock(emeraldOre);
ModLoader.AddName(emeraldOre, "Emerald Ore");
emeraldOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Emeralds/emerald-ore.png");
}
public String Version()
{
return "Emeralds Mod Alpha 1.0";
}
}
BlockEmeraldOre.java
package net.minecraft.src;
public class BlockEmeraldOre extends Block
{
public BlockEmeraldOre(int i, int j)
{
super(i, j, Material.iron);
}
}
Tell me if I missed anything(:
Tutorial 2: Our First Item :biggrin.gif:
Ok so first things first. Go into your already made mod_Emeralds.java class and be ready to add stuff. Here is the first thing we need to add:
Code:
public static final Item emeraldItem = new ItemEmerald(200).setItemName("emeraldItem");
And of course we have an error because we still need to add another class, but just wait. First we need to add this code.
Once again we add the new name for emeraldItem which is Emerald. Now instead of blockIndexInTexture we will use iconIndex for item textures. Also we replace "/terrain.png" with "/gui/items.png" for items items. So after that's done we are almost done. We need to add 1 more class called ItemEmerald.java. Here is the code for it
Code:
package net.minecraft.src;
public class ItemEmerald extends Item
{
public ItemEmerald(int i)
{
super(i);
maxStackSize=64;
}
}
Now the only different thing is the "maxStackSize" which is really easy to understand. Just change the 64 to how many of that item you want to have at one time. You must keep it either 64 or under, if it's higher Minecraft will crash.
Conratulations! You now have your first item
Now just recompile and test it out(:
Finished Code:
mod_Emeralds.java
package net.minecraft.src;
public class mod_Emeralds extends BaseMod
{
public static final Block emeraldOre = new BlockEmeraldOre(150, 0).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("emeraldOre");
public static final Item emeraldItem = new ItemEmerald(200).setItemName("emeraldItem");
public mod_Emeralds()
{
ModLoader.RegisterBlock(emeraldOre);
ModLoader.AddName(emeraldItem, "Emerald");
ModLoader.AddName(emeraldOre, "Emerald Ore");
emeraldItem.iconIndex = ModLoader.addOverride("/gui/items.png", "/Emeralds/emerald.png");
emeraldOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Emeralds/emerald-ore.png");
}
public String Version()
{
return "Emeralds Mod Alpha 1.0";
}
}
ItemEmerald.java
package net.minecraft.src;
public class ItemEmerald extends Item
{
public ItemEmerald(int i)
{
super(i);
maxStackSize=64;
}
}
My E-Mail address is: [email protected]
List of tutorials to be made:
Green = Done
Orange = In Progress
Red = Not sure
Tutorials:
Block Tutorial
Item Tutorial
Armor Tutorial
Block Drops Tutorial
Tools Tutorial
Block Generation Tutorial
Achievements Tutorial
Mob Tutorial
Tutorial 1: Our First Block :biggrin.gif:
The first thing you want to do is make a new class called mod_Namhere.java (make sure it ends in .java It Is VERY IMPORTANT!)(mine will be mod_Emeralds) and then add the code below (The code below will be s starter for all mods you make)
Add This Code:
Ok that is your base structure for the mod (and pretty much every mod you make)
Now we can get started adding the real stuff :smile.gif:
Next Code:(Add directly above "public mod_Emeralds()"
If you are using Eclipse you will get an error because we still need to create a new class, but if your not using Eclipse just sit tight. In this code "public static final Block emeraldOre" is declaring our new block which Minecraft will refer to as emeraldOre. Next, "(150, 0)" The 150 is the ID number of the block (always start with 150 and go up to be safe).The 0 is the texture and we need to keep it 0 for now. The ".setHardness" is how hard the block will be to break (how long it will take) and the 3F is the basic number for an Ore Block in Minecraft. If you want you can change it but keep the F at the end (ex. 5F). The ".setStepSound" just says what your block will sound like when walked on. This can be changed by replacing "Block.soundStoneFootstep" with Block.soundSandFootstep or almost any other block. Finally, the ".setBlockName" just tells Minecraft what name to refer to (this will not be the in-game name!). So now that we are finished with that we go on to the next code.
Code: (Added in between "public mod_Emeralds()"
Ok so now we have "ModLoader.RegisterBlock(emeraldOre);", which just tells ModLoader to register this block with the rest of the blocks. Next is "ModLoader.AddName" , the first name is the original name you gave it which was "emeraldOre" and the second name is the in-game name you are giving your block (mine is "Emerald Ore").And finally we have "emeraldOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Emeralds/emerald-ore.png");", which adds you texture. The first part, "("/terrain.png" is the image you are overwriting (use this for all blocks) and the second part, "/Emeralds/emerald-ore.png" is the image you are overwriting it with. The first part in that, "/Emeralds" is the folder the image will be located in. The last part, "emerald-ore.png" is the name of the image in that folder. Once you get your image folder place that in the folder called minecraft found by clicking Temp, Bin, then Minecraft.Now that class is done we need our BlockEmeraldOre.java class. So after you create that type the following:
Code:
Now the only part you guys need to know on this is the "Material.iron" part. If you look on google at minecraft materials you might find other things you can use.
Now you are finished! All you need to do is recompile and you should have no errors, because i don't. After recompiling take the .class files found in the reobf folder and put them in your minecraft.jar folder along with your block texture folder and modloader.If you need a video tutorial on doing this part just ask and i will be more than happy to.
Congratulations! You have your first block
Finished Codes:
BlockEmeraldOre.java
Tell me if I missed anything(:
Tutorial 2: Our First Item :biggrin.gif:
Ok so first things first. Go into your already made mod_Emeralds.java class and be ready to add stuff. Here is the first thing we need to add:
Code:
And of course we have an error because we still need to add another class, but just wait. First we need to add this code.
Code:
Once again we add the new name for emeraldItem which is Emerald. Now instead of blockIndexInTexture we will use iconIndex for item textures. Also we replace "/terrain.png" with "/gui/items.png" for items items. So after that's done we are almost done. We need to add 1 more class called ItemEmerald.java. Here is the code for it
Code:
Now the only different thing is the "maxStackSize" which is really easy to understand. Just change the 64 to how many of that item you want to have at one time. You must keep it either 64 or under, if it's higher Minecraft will crash.
Conratulations! You now have your first item
Now just recompile and test it out(:
Finished Code:
ItemEmerald.java