Welcome, my username is SCMowns (if you didn't already know) and I'm going to be showing you some very basic steps in order to start modding. My coding series has started on 1.2.5 so you're not to late to join in! and with my simple tutorials you'll be making mods fast and simple! Soon were gonna be going into some Minecraft forge coding and doing some advance tutorials. So how about it! Begin modding!
[media][media][/media[/media]]
You need a software that can allow you to make transparent pictures, like Paint.net Mod_NAME
package net.minecraft.src;
import java.util.Random;
public class mod_NAME extends BaseMod
{
public static final Item NAMEhere = new ItemNAME(2085).setItemName("NAME");
public void load()
{
NAMEhere.iconIndex = ModLoader.addOverride("/gui/items.png" , "/items/pic.png");
ModLoader.addName(NAMEhere, "Ingame -Name");
}
public String getVersion()
{
return "3.14159265";
}
}
To understand this code is quite simple, public class final Item is telling Minecraft that you are making a new item, the (2085) is the Item ID, and the .setItemName("NAME"); is required, but dosn't need a fancy name! in the public void load() section, you will tell modloader where your items is located at, what is needed in order to craft it, and what the name is. My tutorial mentions all this.
ItemNAME:
package net.minecraft.src;
import java.util.Random;
public class ItemNAME extends Item
{
public ItemNAME(int i)
{
super(i);
maxStackSize = 64;
}
public String Version()
{
return "3.14159265";
}
}
Here is another separate class you will need to make. This will define the Item of how much it can stack and to make it an official item registered onto Minecraft
My picture that I used in this tutorial can be downloaded here! (16x16)
3.Making a Sword ( 1.2.5 / 1.3.2 / 1.4.6 )
[media][media][/media[/media]]
public static final Item NAMESword = new ItemSword(3077, EnumToolMaterial.GOLD).setItemName("AnythingHere");
In my tutorial i might have mentioned to edit a BASE class, don't do it! in this code of line you will need to make a new sword and later define it in your public void load. replace NAME with the name of your sword.
paste this in your public void load()
The first line of code is telling modloader to override minecraft item's picture with your new sword sprite. The second line is adding in a name for your sword. In the "NAME Sword" call your sword what ever you like. The tutorial goes over everything.
The picture of the sword that I used can be downloaded here!(16x16)
4. Pickaxe ( Tool set ) ( 1.2.5 / 1.3.2 / 1.4.x )
[media][/media]
In your static section paste this:
public static final Item NAMEPick = new ItemPickaxe(2102, EnumToolMaterial.GOLD).setItemName("Whatever");
replace the NAME with a name of your choice. EnumToolMaterial.GOLD is the tool material, so it's set as gold (defualt). Paste this line of code in your public void load():
NAMEPick.iconIndex = ModLoader.addOverride("/gui/items.png" , "/items/pic.png");
ModLoader.addName(NAMEPick, "NAME Pickaxe");
ModLoader.addRecipe(new ItemStack(NAMEPick, 1), new Object[]
{
"***", " X ", " X ",
'X', Item.stick, '*', Block.dirt
});
The green Pickaxe picture that was used can be downloaded here! (16x16)
5. Axe ( Tool Set ) (1.2.5 / 1.3.2 / 1.4.x )
[media][media][/media[/media]]
In your static section paste this:
public static final Item NAMEAxe = new ItemAxe(2096, EnumToolMaterial.GOLD).setItemName("whatever");
Paste these lines of code in your public void load():
[media][media][/media[/media]]
In your static section paste this:
public static final Item NAMESpade = new ItemSpade(2099, EnumToolMaterial.GOLD).setItemName("Whatever");
Paste these lines of code in your public void load():
NAMESpade.iconIndex = ModLoader.addOverride("/gui/items.png" , "/items/pic.png");
ModLoader.addName(NAMESpade, "NAME Shovel");
ModLoader.addRecipe(new ItemStack(NAMESpade, 1), new Object[]
{
" * ", " X ", " X ",
'X', Item.stick, '*', Block.dirt
});
Watch the video for information of these lines of code!
The green Shovel picture that was used can be downloaded here! (16x16)
8. Ore Generating (1.2.5 / 1.3.2 / 1.4.x )
[media][media][/media[/media]]
pase this line of code in your public static section:
public static final Block NAMEBlock = new BlockNAME(151, 0).setHardness(6F).setResistance(7.0F).setBlockName("whatever");
Create a new class ( for your BlockNAME, and copy nnd paste this code in:
package net.minecraft.src;
import java.util.Random;
public class BlockNAME extends Block
{
protected BlockNAME(int i, int j)
{
super(i, j, Material.iron);
}
public int idDropped(int par1, Random par2Random, int par3)
{
return mod_NAME.ITEM.shiftedIndex;
}
public int quantityDropped(Random random)
{
return 1;
}
public String Version()
{
return "3.14159265";
}
}
follow the video tutorial if you get stuck or confused. Now paste these lines of code in you Public void load():
ModLoader.registerBlock(NAMEBlock);
NAMEBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png" , "/items/pic.png");
ModLoader.addName(NAMEBlock, "In Game Name Ore");
once you have paste that line of code, be sure to change any (NAME) with your block name, now under your static final section, not your public void load. You paste these lines of code:
public void generateSurface(World world, Random random, int chunkX, int chunkZ)
{
Random randomGenerator = random;
for (int i = 0; i < 10; i++)
{
int randPosX = chunkX + randomGenerator.nextInt(20);
int randPosY = random.nextInt(40);
int randPosZ = chunkZ + randomGenerator.nextInt(20);
(new WorldGenMinable(NAMEBlock.blockID, 4)).generate(world, random, randPosX, randPosY, randPosZ);
}
}
This line of code deals with your actual ore generation in chunks. If you would like to generate more ore everywhere then mess with this line of code: for (int i = 0; i < 10; i++) - Change 10 to 30 and see the difference. If you know Minecraft's XYZ's coordence then you can easly chnage where ore will spawn underground. I cover a lot of lines in my video. So check it out!
The green Ore picture that was used can be downloaded here! (16x16)
9. Armor set (1.2.5 / 1.3.2 / 1.4.x)
[media][media][/media[/media]]
Make a new class, and paste this in your mod_NAMEARMOR:
package net.minecraft.src;
import net.minecraft.client.Minecraft;
public class mod_NAME extends BaseMod
{
public void load()
{
}
public String Version()
{
return "1.4.2";
}
public String getVersion()
{
return "3.14159265";
}
}
This is the Basic Modloader coding format. You will use this like a normal mod_file you have made. In your Static final body paste these lines of code:
public static final Item NAMEBody = (new ItemArmor(2200, EnumArmorMaterial.GOLD ,5,1 ).setItemName("Whatever"));
public static final Item NAMEHelmet = (new ItemArmor(2201,EnumArmorMaterial.GOLD ,5,0 ).setItemName("Whatever"));
public static final Item NAMEPants = (new ItemArmor(2202,EnumArmorMaterial.GOLD ,5,2 ).setItemName("Whatever"));
public static final Item NAMEBoots = (new ItemArmor(2203,EnumArmorMaterial.GOLD, 5, 3 ).setItemName("Whatever"));
We are defining the items that you will use to place on your armor slots. Keep in mind this line of code (5,0) The 5 is the new armor number you have added. Since Minecraft has 4 armor sets you are adding in the 5th set. ( If you add in more armor be sure to increase that number to 6) - Now the 0 is where the item will be placed on the armor slots. 0 = HELMET, 1 = BODY, 2 = PANTS, and 3 = BOOTS.
Now paste these lines of code in your Public void load():
10. Publishing / Converting your mod into a download! (1.2.5 / 1.3.2 / 1.4.x )
[media][media][/media[/media]]
It's very simple. Just follow my tutorial xD
11. Smelting ( 1.2.5 ONLY )
[media][media][/media[/media]] *This video and code only work for Minecraft 1.2.5 MCP coding!* Updated code is located down below!
Paste this line of code in your public void load():
ModLoader.addSmelting(BLOCK.blockID, new ItemStack(ITEM, 1));
[media][media][/media[/media]]
The same Idea as in making a block, but a few changes.
Copy and paste this line of code in your "public static final section"
public static final Block NAMEBlock = new BlockNAME(160, 0).setBlockName("whatever").setHardness(5F).setResistance(6F).setStepSound(Sound);
You will need to follow my video for a great description of this line and the following lines.
Copy and paste these lines in your public void load:
And for your BlockNAME you will need to create a new class to define it, make a new class and paste in this code:
in your BlockNAME:
package net.minecraft.src;
import java.util.Random;
public class BlockNAME extends Block
{
public BlockNAME(int i, int j)
{
super(i, j, Material.wood);
}
public int idDropped(int i, Random random, int j)
{
return mod_NAME.BLOCK.blockID;
}
public int quantityDropped(Random random)
{
return 1;
}}
Download my Block that I used in my tutorial Here!
13. Updating your mod to Minecraft 1.3 ( Old ) ( 1.3 )
[media][media][/media[/media]]
STEPS:
- Download Modloader 1.3
- Download the new MCP V1.7 ( for Minecraft 1.3 )
- Get a fresh Minecraft.jar
- (Optional) Get a Minecraft_Server.jar 1.3
- Copy and paste your "Bin" and "resources" folders in your "jars" folder.(make sure you have modded minecraft.jar with modloader
- Decompile
- Move over Old src to New Src
*How to Move Over*
- Either look for your class files in your old src and move over
- Or, Highlight ALL, *copy* and paste in new src, But DON'T REPLACE
- Recompile
- Look for errors. ( you might get 1 )
- Move over pictures / items to new location.
- Open eclipse, and look for your mod_NAME
- Run Minecraft, and enjoy your mod!
Get the New MCP for Minecraft 1.3 and downloads Here!
14. Updating your mod to 1.3.2, with New coding and Fixes* ( 1.3.2 )
What to do!
- Update your version of MCP to 1.3.2
- Copy your old src (source) to your new moddings folder (you can get mine)
- Copy your pictures as well
- Fix errors. If any (look for red lines)
15. Food ( 1.2.5 / 1.3.2 / 1.4.x )
[media][/media]
Paste this line of code in your public static final section:
public static final Item nameHere = new ItemFood(5000, 6, 1F, true).setItemName("anyNameHere");
It's just like making an Item, but this time you make sure it extends ItemFood.
The 1F means how many 1/2 hunger bar is your food going to fill up, so 2 = 1 bar, 3 = 2 1/2, and so on.
The 6 is how long till you get hungy again, 5 is normal, and 3 is very low where you will starve again! The true statement is if you can feed it to a wolf. true = yes, and false = No.
Now paste this line of code in your public void load():
foodNameHere.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/image.png");
ModLoader.addName(foodNameHere, "My Food");
ModLoader.addRecipe(new ItemStack(Food01, 5), new Object[]
{
"***", "* *", "***",
'*', Item.sugar
});
//IF SMELTING ITEM TO ITEM
ModLoader.addSmelting(yourItem.shiftedIndex, new ItemStack(yourSmeltedItem, 1), 1.0F);
//IF SMELTING BLOCKS TO BLOCKS
ModLoader.addSmelting(yourBlock.blockID, new ItemStack(yourSmeltedBlock, 1), 1.0F);
The 1.0F is how much exp you'll recieve with smelting successfully. The rest is explained in my tutorial.
17. Adding Items / Blocks to your Creative Tab ( 1.3.2 / 1.4.x )
[media][media][/media[/media]]
//For a Item:
YourItem.setTabToDisplayOn(CreativeTabs.tabMaterials);
//For a Block
this.setCreativeTab(CreativeTabs.tabBlock);
If you have a sword, then remove the (CreativeTabs.tabMaterials) and spell in " (CreativeTabs. " if you put that point "." you should have a list of the tabs available, like the Materials Tab, Combat, Misc, Food, Tools, etc.
18. Updating your mod to 1.4.2 ( 1.3.2 / 1.2.5 / 1.4.x )
package net.minecraft.src;
import java.awt.Color;
import java.util.Map;
public class mod_NAME extends BaseMod
{
public String getVersion()
{
return "1.4.2";
}
public void load()
{
ModLoader.registerEntityID(EntityNAME.class, "NAME", 30);//registers the mobs name and id
ModLoader.addSpawn("NAME", 15, -5, 1, EnumCreatureType.monster);//makes the mob spawn in game
ModLoader.addLocalization("entity.NAME.name", "NAME");//adds Mob name on the spawn egg
EntityList.entityEggs.put(Integer.valueOf(30), new EntityEggInfo(30, 894731, (new Color(21, 15, 6)).getRGB()));//creates the spawn egg, and chnages color of egg
}
public void addRenderer(Map var1)
{
var1.put(EntityNAME.class, new RenderLiving(new ModelNAME(),.5f));
}
}
First off make yourself a new class, replace all the NAME with the actualy name that you have chosen. In the public void load() Modloader registers the mob/entity that you are creating. I have left side notes on most of the line of code for you to understand what they mean. EntityNAME:
package net.minecraft.src;
public class EntityNAME extends EntityMob//extend this to make mob hostile
{
public EntityNAME(World par1World)
{
super(par1World);
this.texture = "/mob/NAME.png";//Set Mob texture
this.moveSpeed = 0.4f;//sets how fast this mob moves
isImmuneToFire = false;
//below this is all the ai tasks that specify how the mob will behave mess around with it to see what happens
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false));
this.tasks.addTask(2, new EntityAIMoveTwardsRestriction(this, this.moveSpeed));
this.tasks.addTask(3, new EntityAIWander(this, this.moveSpeed));
this.tasks.addTask(4, new EntityAILookIdle(this));
this.targetTasks.addTask(0, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 25.0F, 0, true));
}
public int func_82193_c(Entity par1Entity) //the amount of damage
{
return 4;
}
protected void fall(float par1) {}
public int getMaxHealth() // Mob health
{
return 10;
}
protected String getLivingSound()
{
return "mob.pig.say";
}
protected String getHurtSound()
{
return "mob.pig.say";
}
protected String getDeathSound()
{
return "mob.pig.death";
}
protected int getDropItemId()
{
return Item.stick.shiftedIndex;
}
protected boolean canDespawn()
{
return true;
}
protected boolean isAIEnabled()//Allow your AI task to work?
{
return true;
}
}
Each line is pretty much self explanatory, watch my video and read the side notes to understand the code.
To turn off the fire aspect, put return false; The 5 is the amount of ticks the fire will remain on the entity. Raise it higher if you wish the mod will remain on fire for a very long time.
24. Fuel for Items / Blocks (1.4.x)
[media] [/media]
public int addFuel(int par1, int par2)
{
if(par1 == ITEM.shiftedIndex)//200 ticks is normal,1600 ticks is coal
{
return 200;
}
if(par1 == BLOCK.blockID)
{
return 200;
}
return 0;
}
Watch the video for some additional information!
25. Achievements (1.4.x)
[media][/media]
These line of codes were used in my video, I have explained what they mean. Paste these lines of code in your "public class" section
public static final Achievement achievementFood = new Achievement(5400, "achievementFood", 10, 9, Item.sugar, null).setSpecial().setIndependent().registerAchievement();
public static final Achievement achievementGem = new Achievement(5401, "achievementGem", 10, 12, Item.bone, achievementFood).registerAchievement();
Paste these lines of code in your "public void load()"
ModLoader.addAchievementDesc(achievementFood, "Yummy!", "Craft a Donut!!");
ModLoader.addAchievementDesc(achievementGem, "Green GEM!", "Pick Up a Green Gem!");
paste these lines of code underneath the public void load, make sure you do notpaste them in public void load():
[media][/media]
Follow the tutorial on making a new WorldGenNether class by copying the src code from WorldGenMinable.
Here is the code that you will place in your mod_mod:
public void generateNether(World var1, Random var2, int var3, int var4)
{
int var5;
int var6;
int var7;
int var8;
int veinsize=8;//Size of the vein
int rarity=12;//the rarity of the ore
for (var5 = 0; var5 < rarity; ++var5)
{
var6 = var3 + var2.nextInt(16);
var7 = var2.nextInt(128);
var8 = var4 + var2.nextInt(16);
new WorldGenNether(Block.dirt.blockID, veinsize).generate(var1, var2, var6, var7, var8);//replace dirt with your custom ore
}
}
I left some side notes, explaining the obvious. But anyways! Hope this helps!
27. Advance Blocks: Gravitational Physics, Light Value, and Unbreakable(1.4.x)
[media][/media]
For the gravitational block you'll need to follow along with my tutorial,
to make your block unbreackable add in this line of code to your "pubic static final"
.setBlockUnbreakable()
Now to make your block have a light value, you'll add this line of code to your "public static final"
.setLightValue(5)
Increase or decrease the number 5 to lower or increase the light radius.
After making your Mod class, now paste the following code your class:
package SCMowns.Tutorial; //Package directory
/*
* Basic importing
*/
import net.minecraft.block.Block;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.EnumHelper;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
/*
* Basic needed forge stuff
*/
@Mod(modid="TutorialMod",name="Tutorial Mod",version="v1")
@NetworkMod(clientSideRequired=true,serverSideRequired=false)
public class TutorialMod {
/*
* ToolMaterial
*/
//Telling forge that we are creating these
public static Item topaz;
//Declaring Init
@Init
public void load(FMLInitializationEvent event){
// define items/blocks
topaz = new GemItems(2013).setUnlocalizedName("topaz");
//adding names
LanguageRegistry.addName(topaz, "Topaz Gem");
//crafting
}
}
Watch the video tutorial for information about what some lines mean.
Time to make a class for the GemItems. Here's what you add in that class:
package SCMowns.Tutorial;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.*;
import net.minecraft.creativetab.CreativeTabs;
public class GemItems extends Item {
public GemItems(int par1) {
super(par1); //Returns super constructor: par1 is ID
setCreativeTab(CreativeTabs.tabMaterials); //Tells the game what creative mode tab it goes in
}
}
alright, after importing everything we need, now lets make the block,
in your public class brackets, make a new public static block.
public static Block BlockName;
now we need to declare what BlockName is,
in your public void load brackets, put there lines of code inside:
BlockName= new NewBlockClass(3608, "BlockName_Whatever").setUnlocalizedName("Texture_For_Block").setHardness(2.0F).setStepSound(Block.soundMetalFootstep).setResistance(10.0F);
GameRegistry.registerBlock(BlockName, "BlockName");
LanguageRegistry.addName(BlockName, "Blood Name");
setHardness = how hard your block will be, to see the list of vanilla blocks, you can check out the Block.java file
setResistance is how much resistence would the block have against impacts.
You can follow the video tutorial for the little things.
Now we need to define our new NewBlockClass.java.
Make a new class, for example: NewBlockClass
Now paste these lines of code inside:
package Your.Package;
import java.util.Random;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
public class NewBlockClass extends Block {
public BlockName(int par1, String texture) {
super(par1, Material.rock);
setCreativeTab(CreativeTabs.tabBlock); //place in creative tabs
}
//drops when broken with pickaxe
public int idDropped(int par1, Random par2Random, int par3)
{
return MainClass.ITEM.itemID;
}
public int quantityDropped(Random random)
{
return 3;
}
//texure the block (Not sure if it's required)
public String getTextureFile(){
return "/textures/blocks/TEXTURE_NAME.png";
}
}
Video: Src: Basic Crafting:
In your main class, paste the code in your public void load():
GameRegistry.addRecipe(new ItemStack(topazblock,1), new Object[]{
"TTT","TTT","TTT",'T',topaz,
});
To read this code, we are making a topaz block with 9 topaz. T = 1 topaz, (topazblock,1) = we are crafting a topaz block and only getting one of them.
Here is an example using numbers in the crafting grid. Do you see the "TTT","TTT","TTT"
Not think of this code:
"TTT","TTT","TTT"
as:
"123","456","789"
That is how you can tell the crafting grid in java. (Watch my video for a better explanation.)
Shapeless Crafting:
shapless crafting is making anything freely in the crafting table, without having any specific order.
(watch the video for a better explanation)
GameRegistry.addShapelessRecipe(new ItemStack(TrioItem,1), new Object[]{
RubyItem, SapphireItem, Item.emerald });
The coding is a lot similar to the Basic Crafting, but worded differently.
To make a Trio Gem, You need a Rubie, Sapphire, and an Emerald. These gems can be placed in the crafting table without any order to make a Trio Gem. ( This mod is Copyrighted. TrioGems Mod.)
6.Ores / World Gen in Overworld 1.5.2 (New!)
Video:
In order to make an ore in Minecraft forge we need to make a basic block. We have already made one before (Episode 4). After we have made a new block, we need it to generate around the overworld. We need to make a new World generator!
In your Main class, under public void load's brackets we need to register out new world gen. Paste this line of code within the brackets:
You will have a red underline around this are: WorldGeneratorSCMowns - You need to hover over it, and make a new class in your package named WorldGeneratorSCMowns. (or whatever you named it) You can call it WorldGeneratorOreGen (To make it simple)
Next after you have made a new class called "WorldGeneratorSCMowns", Paste this entire line of codes inside that class.
package Your.Package;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.IWorldGenerator;
public class WorldGeneratorSCMowns implements IWorldGenerator {
@Override
public void generate(Random random, int chunkX, int chunkZ, World world,
IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
// TODO Auto-generated method stub
switch(world.provider.dimensionId){
//case -1: generateNether(world, random,chunkX*16,chunkZ*16);
case 0 : generateSurface(world, random,chunkX*16,chunkZ*16);
}
}
private void generateSurface(World world, Random random, int BlockX, int BlockZ) {
for(int i =0; i<10;i++){
int Xcoord = BlockX + random.nextInt(16);
int Zcoord = BlockZ + random.nextInt(16);
int Ycoord = random.nextInt(16);
(new WorldGenMinable(YourClass.YourBlock.blockID, 4)).generate(world, random, Xcoord, Ycoord, Zcoord);
}}}
I have left some code out of the class, that is where you see the "//" comment. That will be used in our Nether ore generation if you are inerested in that later on.
So first off, Make sure you fix your package import.
then rename anything that you have changed, so if you changed the name "WorldGeneratorSCMowns" to something else like "WorldGeneratorMyOres" rename this line of code:
public class WorldGeneratorSCMowns implements IWorldGenerator
If we look at our private void generateSurface we will be making our Basic Block genterate around in Minecraft. So since the case is set to 0, it will generate in the overworld, see this line of codes:
case 0 : generateSurface(world, random,chunkX*16,chunkZ*16);
If the case = 0 then it will generate in the overworld,
we have this here in our private void generateSurface:
(int i =0; i<10;i++)
i is the case, and it = 0. You can mess around with the i<10 - The higher the #, it should increase the chances when the ore spawns in the overworld.
For these lines of code:
int Xcoord = BlockX + random.nextInt(16);
int Zcoord = BlockZ + random.nextInt(16);
int Ycoord = random.nextInt(16);
These are the cordance of where the ores generate at random. I normally leave them 16x16x16 if you would like them to generate like Iron ores, You can chnage 16 to 32, if you would like the ore to generate more farther apart from each other.
For this line of code:
(new WorldGenMinable(YourClass.YourBlock.blockID, 4)).generate(world, random, Xcoord, Ycoord, Zcoord);
We are defining what is being generated. Replace YourClass with your main class, and YourBlock with your Basic Block you made. 4 = the vane size of the ore. Like how many ores will be together when generating. You can lower it or raise it if you like. Other then that, you should be set! Check the video for more info!
7.Tools (Sword, Shovel, Pickaxe, Hoe, Axe) and new Tool material1.5.2 (New!)
Video:
In order to begin making your first forge tools you need to make a new enum tool material. What that is, think of a diamond, it has the highest durability, strengh, etc. You can make your weapons/tools weak or strong, all it takes is to make a new enum tool material.
Copy and paste this line of coding in the public class of your main mod class:
For an example, this tool material named EnumToolMaterialTopaz is considered "Low Powered". For more info about the enum tool material, check out Minecraft's class: "EnumToolMaterial".
Once you have the enum tool material, time to make the tools!
Copy and paste this line of codes in your public class section:
public static Item TopazAxe;
public static Item TopazShovel;
public static Item TopazSword;
public static Item TopazPickaxe;
public static Item TopazHoe;
Now we have made the tools registered, time to define them,
Copy and paste these lines of code in your public void load():
TopazAxe = new SCMownsAxe(9014, EnumToolMaterialTopaz).setUnlocalizedName("Texture_file_name");
TopazShovel = new SCMownsShovel(9015, EnumToolMaterialTopaz).setUnlocalizedName("Texture_file_name");
TopazPickaxe = new SCMownsPickaxe(9016, EnumToolMaterialTopaz).setUnlocalizedName("Texture_file_name");
TopazHoe = new SCMownsHoe(9017, EnumToolMaterialTopaz).setUnlocalizedName("Texture_file_name");
TopazSword = new SCMownsSword(9018, EnumToolMaterialTopaz).setUnlocalizedName("Texture_file_name");
You will get some red underlines, we will clear them up in a bit. First off make sure all your picture file names are replaced. "Texture_file_name" replace that with your pictures file's name. The 9014 is the Item ID. And now we gotta make a new class for SCMownsAxe, SCMownsShovel, SCMownsPickaxe, SCMownsHoe, and SCMownsSword.
So make those new classes!
And once you are done making all the 5 new classes, paste this inside the SCMownsAxe, SCMownsShovel, SCMownsPickaxe, SCMownsHoe, and SCMownsSword classes.
package Your.Package;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemPickaxe;
// *REMEBER* Change "ItemPickaxe" to ItemAxe, ItemHoe, ItemSword, etc if you are making those tools!
public class SCMownsPickaxe extends ItemPickaxe {
public SCMownsPickaxe(int ItemID, EnumToolMaterial material){
super(ItemID, material);
}
}
Read that remember comment! You will need to change the "ItemPickaxe" if you are making a axe, sword, shovel, etc.
In order to begin making a creative tab in Minecraft forge you will need to open up your main mod class and paste the following code: (paste it somewhere in your public static section)
public static CreativeTabs tabYourTab = new TabSCMownsTutorialMod(CreativeTabs.getNextID(), "SCMowns Tutorial Mod");
Reading this, you are creating a new CreativeTab. tabYourTab is the actual tab you are making. Change that to something different like tabSCMowns, tabSteven, etc. What CreativeTabs.getNextID() is doing is looking for the next available ID for the creative tab. And inside those quotes I put SCMowns Tutorial Mod, change that to something else, the reason why is when the player hovers over the tab that name will appear.
Make sure to import the following package:
import net.minecraft.creativetab.CreativeTabs;
You will have a red underline on TabSCMownsTutorialMod. What you need to do now is create a new class called: TabSCMownsTutorialMod, and paste in this code:
package SCMowns.Tutorial;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
public final class TabSCMownsTutorialMod extends CreativeTabs
{
public TabSCMownsTutorialMod(int par1, String par2Str)
{
super(par1, par2Str);
}
//sets the image for the creative tab
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex()
{
//there is a difference between items and blocks. will give an example of both
return TutorialMod.topaz.itemID;
}
//sets the title/name for the creative tab
public String getTranslatedTabLabel()
{
return "SCMowns Tutorial Mod";
}
}
So now that you have created a new class called TabSCMownsTutorialMod, you will need to make sure your package is right, and fix any red underlines you might come across. You will need to change " return TutorialMod.topaz.itemID;" to a item/block of your choice. What that is doing is displaying that particular item/block on the creative tab. I picked my Topaz Gem to be displayed, see it here:
Ok, now after you have found the right block/item to showcase on the tab, time to change this: "return "SCMowns Tutorial Mod";" changing that to anything you like will have it displayed on the actual tab itself. As you see on the picture, it's witten on the tab. (above the tools/blocks)
So now that you have changed everything. Time for you to set your items and blocks in that new creative tab. To do that, find your item/block classes, like "GemItems" for example, or "SCMownsBasicAxe" or "TopazOre". when you open the class replace the old creative tab code and use this one:
His videos are funny too! I'm learning how to mod from you! Although at first, It confuses me but now it is getting better for me since I've tried modding.
I just finished Ep2 I did everything EXACTLY like you. With the new Minecraft inventory will it just not show but it would in survival after i get to making my first ore? Because my gem didn't show up?
Edit: Nvm -.- After I went through more of the videos I found the video on "Making Items Show Up in The Creative Tab".
Hey SCMowns2 I have a problem when trying to test my mod woth 50 gems!!! I was soo excited BECAUSE IT TOOK ME 3 MONTHS TO DO IT but... it failed... help?!??
1. Setting up MCP( Minecraft Coder Pack) Modloader ( 1.2.5 / 1.3.2 / 1.4.x / 1.5.1/ 1.5.2 )
[media][media][/media[/media]]
In the video I show you how to set up MCP. To get the downloads click on the links below (pick your version)
Minecraft 1.2.5
Minecraft 1.3.2
Minecraft 1.4.2
Minecraft 1.4.4
Minecraft 1.4.5
Minecraft 1.4.6
Minecraft 1.5.1
Minecraft 1.5.2
[media][media][/media[/media]]
You need a software that can allow you to make transparent pictures, like Paint.net
Mod_NAME
To understand this code is quite simple, public class final Item is telling Minecraft that you are making a new item, the (2085) is the Item ID, and the .setItemName("NAME"); is required, but dosn't need a fancy name! in the public void load() section, you will tell modloader where your items is located at, what is needed in order to craft it, and what the name is. My tutorial mentions all this.
ItemNAME:
Here is another separate class you will need to make. This will define the Item of how much it can stack and to make it an official item registered onto Minecraft
My picture that I used in this tutorial can be downloaded here! (16x16)
[media][media][/media[/media]]
In my tutorial i might have mentioned to edit a BASE class, don't do it! in this code of line you will need to make a new sword and later define it in your public void load. replace NAME with the name of your sword.
paste this in your public void load()
The first line of code is telling modloader to override minecraft item's picture with your new sword sprite. The second line is adding in a name for your sword. In the "NAME Sword" call your sword what ever you like. The tutorial goes over everything.
The picture of the sword that I used can be downloaded here! (16x16)
[media][/media]
In your static section paste this:
replace the NAME with a name of your choice. EnumToolMaterial.GOLD is the tool material, so it's set as gold (defualt). Paste this line of code in your public void load():
The green Pickaxe picture that was used can be downloaded here! (16x16)
[media][media][/media[/media]]
In your static section paste this:
Paste these lines of code in your public void load():
Watch the video for infomation!
The green Axe picture that was used can be downloaded here! (16x16)
[media][media][/media[/media]]
In your static section paste this:
Paste these lines of code in your public void load():
Watch the video for infomation!
The green Hoe picture that was used can be downloaded here! (16x16)
[media][media][/media[/media]]
In your static section paste this:
Paste these lines of code in your public void load():
Watch the video for information of these lines of code!
The green Shovel picture that was used can be downloaded here! (16x16)
[media][media][/media[/media]]
pase this line of code in your public static section:
Create a new class ( for your BlockNAME, and copy nnd paste this code in:
follow the video tutorial if you get stuck or confused. Now paste these lines of code in you Public void load():
once you have paste that line of code, be sure to change any (NAME) with your block name, now under your static final section, not your public void load. You paste these lines of code:
This line of code deals with your actual ore generation in chunks. If you would like to generate more ore everywhere then mess with this line of code: for (int i = 0; i < 10; i++) - Change 10 to 30 and see the difference. If you know Minecraft's XYZ's coordence then you can easly chnage where ore will spawn underground. I cover a lot of lines in my video. So check it out!
The green Ore picture that was used can be downloaded here! (16x16)
[media][media][/media[/media]]
Make a new class, and paste this in your mod_NAMEARMOR:
This is the Basic Modloader coding format. You will use this like a normal mod_file you have made. In your Static final body paste these lines of code:
We are defining the items that you will use to place on your armor slots. Keep in mind this line of code (5,0) The 5 is the new armor number you have added. Since Minecraft has 4 armor sets you are adding in the 5th set. ( If you add in more armor be sure to increase that number to 6) - Now the 0 is where the item will be placed on the armor slots. 0 = HELMET, 1 = BODY, 2 = PANTS, and 3 = BOOTS.
Now paste these lines of code in your Public void load():
Watch my video for more details.
Pictures! ( used in video )
Download the bundle! (16x16)
[media][media][/media[/media]]
It's very simple. Just follow my tutorial xD
[media][media][/media[/media]]
*This video and code only work for Minecraft 1.2.5 MCP coding!* Updated code is located down below!
Paste this line of code in your public void load():
Watch the video for information!
Download my "Shiny Gem" Here! (16x16)
[media][media][/media[/media]]
The same Idea as in making a block, but a few changes.
Copy and paste this line of code in your "public static final section"
You will need to follow my video for a great description of this line and the following lines.
Copy and paste these lines in your public void load:
ModLoader.registerBlock(NAMEblock);
ModLoader.addName(Rubyblock, "In-Game-Name Block");
ModLoader.addRecipe(new ItemStack(NAMEblock, 1), new Object [] {"###", "###", "###", Character.valueOf('#'), ITEM});; padding:10px; margin-bottom:10px;">NAMEblock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/items/pic.png");
ModLoader.registerBlock(NAMEblock);
ModLoader.addName(Rubyblock, "In-Game-Name Block");
ModLoader.addRecipe(new ItemStack(NAMEblock, 1), new Object [] {"###", "###", "###", Character.valueOf('#'), ITEM});
in your BlockNAME:
Download my Block that I used in my tutorial Here!
[media][media][/media[/media]]
STEPS:
- Download Modloader 1.3
- Download the new MCP V1.7 ( for Minecraft 1.3 )
- Get a fresh Minecraft.jar
- (Optional) Get a Minecraft_Server.jar 1.3
- Copy and paste your "Bin" and "resources" folders in your "jars" folder.(make sure you have modded minecraft.jar with modloader
- Decompile
- Move over Old src to New Src
*How to Move Over*
- Either look for your class files in your old src and move over
- Or, Highlight ALL, *copy* and paste in new src, But DON'T REPLACE
- Recompile
- Look for errors. ( you might get 1 )
- Move over pictures / items to new location.
- Open eclipse, and look for your mod_NAME
- Run Minecraft, and enjoy your mod!
Get the New MCP for Minecraft 1.3 and downloads Here!
[media][media][/media[/media]]
- Update your version of MCP to 1.3.2
- Copy your old src (source) to your new moddings folder (you can get mine)
- Copy your pictures as well
- Fix errors. If any (look for red lines)
[media][/media]
Paste this line of code in your public static final section:
It's just like making an Item, but this time you make sure it extends ItemFood.
The 1F means how many 1/2 hunger bar is your food going to fill up, so 2 = 1 bar, 3 = 2 1/2, and so on.
The 6 is how long till you get hungy again, 5 is normal, and 3 is very low where you will starve again! The true statement is if you can feed it to a wolf. true = yes, and false = No.
Now paste this line of code in your public void load():
Download my Food item here! ( Doughnut )
[media][media][/media[/media]]
The 1.0F is how much exp you'll recieve with smelting successfully. The rest is explained in my tutorial.
[media][media][/media[/media]]
If you have a sword, then remove the (CreativeTabs.tabMaterials) and spell in " (CreativeTabs. " if you put that point "." you should have a list of the tabs available, like the Materials Tab, Combat, Misc, Food, Tools, etc.
[media][media][/media[/media]]
Download all the requirements!
[media][/media[/media]]
Link Removed
Download my Mob save here!
You will need Internet Explorer to right-click the "Download/Website" link on Techne's forum to save it as an application.
( Watch my Video )
[media][media][/media[/media]]
Check out Paint.net
Download my Mob Texture!
[media][media][/media[/media]]
mod_NAME.java:
First off make yourself a new class, replace all the NAME with the actualy name that you have chosen. In the public void load() Modloader registers the mob/entity that you are creating. I have left side notes on most of the line of code for you to understand what they mean.
EntityNAME:
Each line is pretty much self explanatory, watch my video and read the side notes to understand the code.
Here is my ModelGreenMonster
Check out Notepad++
Download my Mob Texture!
[media] [/media]
You will need to paste these body of code in your modelNAME.java file! Mess with the #'s to get random rotation results!
[media] [/media]
For Minecraft 1.4.4
Download the newest Modloader here! (1.4.4)
Download MCP Version 7.19 for 1.4.4 here!
For Minecraft 1.4.5
Download the files here!
[media] [/media]
The enchantment effect code is here:
Leave the return to true in order to get the enchantment effect on the item!
[media] [/media]
Here is the code that was used in this video!:
Pay attention to \u00a7E that E is the placement for a color code. In order to see the color codes link is right here:
Color codes webpage!
Change the E to 1 or 2 or 4, you will get a different color, this method does not work on blocks. I will look into that later on
[media] [/media]
Code:
To turn off the fire aspect, put return false; The 5 is the amount of ticks the fire will remain on the entity. Raise it higher if you wish the mod will remain on fire for a very long time.
[media] [/media]
Watch the video for some additional information!
[media][/media]
These line of codes were used in my video, I have explained what they mean. Paste these lines of code in your "public class" section
Paste these lines of code in your "public void load()"
paste these lines of code underneath the public void load, make sure you do not paste them in public void load():
Follow the video tutorial for more information.
[media][/media]
Follow the tutorial on making a new WorldGenNether class by copying the src code from WorldGenMinable.
Here is the code that you will place in your mod_mod:
I left some side notes, explaining the obvious. But anyways! Hope this helps!
[media][/media]
For the gravitational block you'll need to follow along with my tutorial,
to make your block unbreackable add in this line of code to your "pubic static final"
Now to make your block have a light value, you'll add this line of code to your "public static final"
Increase or decrease the number 5 to lower or increase the light radius.
Downloads Click Here!
1. Setting up MCP, Eclipse, and Java JDK with Forge 1.5.1 / 1.5.2
Download(s):
Minecraft 1.5.1
Minecraft 1.5.2
After making your Mod class, now paste the following code your class:
Watch the video tutorial for information about what some lines mean.
Time to make a class for the GemItems. Here's what you add in that class:
You can download the topaz here!
Download(s):
Minecraft 1.5.2
Video:
First off, make sure that you have imported everything that is needed in your main class:
alright, after importing everything we need, now lets make the block,
in your public class brackets, make a new public static block.
now we need to declare what BlockName is,
in your public void load brackets, put there lines of code inside:
setHardness = how hard your block will be, to see the list of vanilla blocks, you can check out the Block.java file
setResistance is how much resistence would the block have against impacts.
You can follow the video tutorial for the little things.
Now we need to define our new NewBlockClass.java.
Make a new class, for example: NewBlockClass
Now paste these lines of code inside:
Download my Texture Here!
Video:
Src:
Basic Crafting:
In your main class, paste the code in your public void load():
To read this code, we are making a topaz block with 9 topaz. T = 1 topaz, (topazblock,1) = we are crafting a topaz block and only getting one of them.
Here is an example using numbers in the crafting grid. Do you see the "TTT","TTT","TTT"
Not think of this code:
as:
That is how you can tell the crafting grid in java. (Watch my video for a better explanation.)
Shapeless Crafting:
shapless crafting is making anything freely in the crafting table, without having any specific order.
(watch the video for a better explanation)
The coding is a lot similar to the Basic Crafting, but worded differently.
To make a Trio Gem, You need a Rubie, Sapphire, and an Emerald. These gems can be placed in the crafting table without any order to make a Trio Gem. ( This mod is Copyrighted. TrioGems Mod.)
Video:
In order to make an ore in Minecraft forge we need to make a basic block. We have already made one before (Episode 4). After we have made a new block, we need it to generate around the overworld. We need to make a new World generator!
You will have a red underline around this are: WorldGeneratorSCMowns - You need to hover over it, and make a new class in your package named WorldGeneratorSCMowns. (or whatever you named it) You can call it WorldGeneratorOreGen (To make it simple)
I have left some code out of the class, that is where you see the "//" comment. That will be used in our Nether ore generation if you are inerested in that later on.
So first off, Make sure you fix your package import.
then rename anything that you have changed, so if you changed the name "WorldGeneratorSCMowns" to something else like "WorldGeneratorMyOres" rename this line of code:
public class WorldGeneratorSCMowns implements IWorldGenerator
If we look at our private void generateSurface we will be making our Basic Block genterate around in Minecraft. So since the case is set to 0, it will generate in the overworld, see this line of codes:
If the case = 0 then it will generate in the overworld,
we have this here in our private void generateSurface:
i is the case, and it = 0. You can mess around with the i<10 - The higher the #, it should increase the chances when the ore spawns in the overworld.
For these lines of code:
These are the cordance of where the ores generate at random. I normally leave them 16x16x16 if you would like them to generate like Iron ores, You can chnage 16 to 32, if you would like the ore to generate more farther apart from each other.
For this line of code:
We are defining what is being generated. Replace YourClass with your main class, and YourBlock with your Basic Block you made. 4 = the vane size of the ore. Like how many ores will be together when generating. You can lower it or raise it if you like. Other then that, you should be set! Check the video for more info!
Download my Topaz Block Picture here!
7. Tools (Sword, Shovel, Pickaxe, Hoe, Axe) and new Tool material1.5.2 (New!)
Video:
In order to begin making your first forge tools you need to make a new enum tool material. What that is, think of a diamond, it has the highest durability, strengh, etc. You can make your weapons/tools weak or strong, all it takes is to make a new enum tool material.
For an example, this tool material named EnumToolMaterialTopaz is considered "Low Powered". For more info about the enum tool material, check out Minecraft's class: "EnumToolMaterial".
Once you have the enum tool material, time to make the tools!
Now we have made the tools registered, time to define them,
You will get some red underlines, we will clear them up in a bit. First off make sure all your picture file names are replaced. "Texture_file_name" replace that with your pictures file's name. The 9014 is the Item ID. And now we gotta make a new class for SCMownsAxe, SCMownsShovel, SCMownsPickaxe, SCMownsHoe, and SCMownsSword.
So make those new classes!
Read that remember comment! You will need to change the "ItemPickaxe" if you are making a axe, sword, shovel, etc.
Don't forget to add the names to the item!
Watch the video for a better understanding of everything!
Video:
In order to begin making a creative tab in Minecraft forge you will need to open up your main mod class and paste the following code: (paste it somewhere in your public static section)
Reading this, you are creating a new CreativeTab. tabYourTab is the actual tab you are making. Change that to something different like tabSCMowns, tabSteven, etc. What CreativeTabs.getNextID() is doing is looking for the next available ID for the creative tab. And inside those quotes I put SCMowns Tutorial Mod, change that to something else, the reason why is when the player hovers over the tab that name will appear.
Make sure to import the following package:
You will have a red underline on TabSCMownsTutorialMod. What you need to do now is create a new class called: TabSCMownsTutorialMod, and paste in this code:
So now that you have created a new class called TabSCMownsTutorialMod, you will need to make sure your package is right, and fix any red underlines you might come across. You will need to change " return TutorialMod.topaz.itemID;" to a item/block of your choice. What that is doing is displaying that particular item/block on the creative tab. I picked my Topaz Gem to be displayed, see it here:
Ok, now after you have found the right block/item to showcase on the tab, time to change this: "return "SCMowns Tutorial Mod";" changing that to anything you like will have it displayed on the actual tab itself. As you see on the picture, it's witten on the tab. (above the tools/blocks)
So now that you have changed everything. Time for you to set your items and blocks in that new creative tab. To do that, find your item/block classes, like "GemItems" for example, or "SCMownsBasicAxe" or "TopazOre". when you open the class replace the old creative tab code and use this one:
To best understand this episode, watch the video!
* If you would like the SRC codes of everything I have been working on from ep. 1- 8, click here for the download! *
Thanks SCMowns, this is really helpful for the community. Your tutorials are very detailed and easy to follow along.
+1 rep for you!
Yeah, his videos are fantastic!
Thanks I'll make sure I update this thread asap with new coding tutorials
Back on MCF baby.
I will make an episode on that soon
I know I have to make a new mob lol.
Back on MCF baby.
I would recommend you to post a topic on my help forums.
Edit: Nvm -.- After I went through more of the videos I found the video on "Making Items Show Up in The Creative Tab".
Even thought I'm not into coding, great job on making this topic, it probably took you like 10h lawl
Hey I know you!
Did you try to download the link using Internet Explorer? or are you on a Mac?
( If I don't reply quick check out my Help forums )