Post: How to make custom tools in Minecraft using modloader [1.8.1]
10-02-2011, 02:25 PM #1
Merkii
Former Staff
(adsbygoogle = window.adsbygoogle || []).push({}); So there's a few things you'll need to go ahead and download first,
Minecraft Coders Pack, The latest version,

You must login or register to view this content.

A text editor, I will use Notepad++

And Java SDK installed

Link: You must login or register to view this content.
Only install your systems version Happy

NOTE: Backup your .Minecraft folder, then delete it, and redownload the clean version!!!!!

Download risugami's modloader: You must login or register to view this content. And install it in the clean minecraft.jar
Delete META-inf and we're ready to go Happy

[Multipage= Step 1: Decompiling] NOTE: Backup your .Minecraft folder, then delete it, and redownload the clean version!!!!!
NOTE: Backup your .Minecraft folder, then delete it, and redownload the clean version!!!!!
NOTE: Backup your .Minecraft folder, then delete it, and redownload the clean version!!!!!




Ok So the first thing we need to do is decompile minecraft so we can edit it, This is simply done.

1.) Go ahead and open your .minecraft folder
(Type %appdata% in RUN, Open the .minecraft folder )

2.) Open up your extracted MCP folder, Then open up the JARS folder.

3.) Go ahead and COPY+PASTE the bin folder and Resources from .minecraft into the Jars folder Smile (C&P THEM)

4.) Now go to the main directory in MCP and run Decompile.bat

Now go to SRC<MINECRAFT<NET<MINECRAFT<SRC< There should be 100s of Java files Winky Winky This is good! Now we can go onto editing them Smile


[multipage=Step 2: Creating the MAIN java!]

1.) in the SRC folder containing all your java's create a file called mod_MERK.java Edit MERK to whatever you like!
2.) Make sure it's JAVA! then open it in Notepad++
3.) Copy and paste this code into it,
    package net.minecraft.src;
import java.util.Random;

public class [COLOR=RED][b]mod_Base[/b][/color] extends BaseMod
{

public [COLOR=RED][b]mod_Base[/b][/color]()
{

}

public String Version()
{
return "3.14159265";
}
}


Change mod_Base to your Java name, Mine will be mod_MERK (Cap sensitive)

4.) Ok now under Public clasas mod_Base extends BaseMod and above public mod_Base() add this code
    	public static final Item Pick = new ItemPickaxe([color=blue][b]2010, [color=Red][b]EnumToolMaterial.OBSIDIANTOOL[/b][/color]).setItemName("Changethis1");
public static final Item Spade = new ItemSpade([color=blue][b]2009[/b][/color], [color=Red][b]EnumToolMaterial.OBSIDIANTOOL[/b][/color]).setItemName("Change2");
public static final Item Axe = new ItemAxe([color=blue][b]2008[/b][/color], [color=Red][b]EnumToolMaterial.OBSIDIANTOOL[/b][/color]).setItemName("Change3");
public static final Item Hoe = new ItemHoe([color=blue][b]2007[/b][/color], [color=Red][b]EnumToolMaterial.OBSIDIANTOOL[/b][/color]).setItemName("Change4");
public static final Item Sword = new ItemSword([color=blue][b]2006[/b][/color], [color=Red][b]EnumToolMaterial.OBSIDIANTOOL[/b][/color]).setItemName("Change5");

What to edit:
RED = Don't touch this YET! We will change this later into the tutorial!
BLUE = These are the tools Data Values, Change them to something above 200 and they must be different!

What YOUR code should look like:
    package net.minecraft.src;
import java.util.Random;

public class [COLOR=RED][b]mod_Base[/b][/color] extends BaseMod
{
public static final Item Pick = new ItemPickaxe([color=blue][b]2010, [color=Red][b]EnumToolMaterial.OBSIDIANTOOL[/b][/color]).setItemName("Changethis1");
public static final Item Spade = new ItemSpade([color=blue][b]2009[/b][/color], [color=Red][b]EnumToolMaterial.OBSIDIANTOOL[/b][/color]).setItemName("Change2");
public static final Item Axe = new ItemAxe([color=blue][b]2008[/b][/color], [color=Red][b]EnumToolMaterial.OBSIDIANTOOL[/b][/color]).setItemName("Change3");
public static final Item Hoe = new ItemHoe([color=blue][b]2007[/b][/color], [color=Red][b]EnumToolMaterial.OBSIDIANTOOL[/b][/color]).setItemName("Change4");
public static final Item Sword = new ItemSword([color=blue][b]2006[/b][/color], [color=Red][b]EnumToolMaterial.OBSIDIANTOOL[/b][/color]).setItemName("Change5");

public [COLOR=RED][b]mod_Base[/b][/color]()
{

}

public String Version()
{
return "3.14159265";
}
}


Good now we will edit
    public mod_Base()
{

}

! Now inbetween the {}'s do a couple spaces,

And add this, This declares the textures the tool uses!
    		Pick.iconIndex = ModLoader.addOverride("/gui/items.png", [color=Red][b]"/Pick.png");[/b][/color]
Spade.iconIndex = ModLoader.addOverride("/gui/items.png", [color=Red][b]"/Spade.png");[/b][/color]
Axe.iconIndex = ModLoader.addOverride("/gui/items.png", [color=Red][b]"/Axe.png");[/b][/color]
Hoe.iconIndex = ModLoader.addOverride("/gui/items.png", [color=Red][b]"/Hoe.png");[/b][/color]
Sword.iconIndex = ModLoader.addOverride("/gui/items.png", [color=Red][b]"/Sword.png");[/b][/color]

RED: You can edit everything after the "/" Just make sure when creating the images in photoshop you have the exact Capitals and letters Smile

ok now do 2 or 3 spaces down and add, this code will define the tools ingame name Smile
    		ModLoader.AddName(Pick, "[color=blue][b]Pickaxe"[/b][/color]);
ModLoader.AddName(Spade, "[color=blue][b]Shovel[/b][/color]");
ModLoader.AddName(Axe, "[color=blue][b]Axe[/b][/color]");
ModLoader.AddName(Hoe, "[color=blue][b]Hoe[/b][/color]");
ModLoader.AddName(Sword, "[color=blue][b]Sword[/b][/color]");

Everything in BLUE Can be edited! These are the ingame names!

Ok we're nearly done! We just need to add CRAFTING recipes to the file now!
Do 2 more lines down and add
    
ModLoader.AddRecipe(new ItemStack(Pick, 1), new Object[] {
[Color=red][b]"***", " # ", " # "[/b][/color], Character.valueOf('*'Winky Winky, [Color=orange][b]Block.obsidian[/b][/color], Character.valueOf('#'Winky Winky, [Color=orange][b]Item.stick[/b][/color]
});
ModLoader.AddRecipe(new ItemStack(Axe, 1), new Object[] {
[Color=red][b]"** ", "*# ", " # "[/b][/color], Character.valueOf('*'Winky Winky, [Color=orange][b]Block.obsidian[/b][/color], Character.valueOf('#'Winky Winky, [Color=orange][b]Item.stick[/b][/color]
});
ModLoader.AddRecipe(new ItemStack(Spade, 1), new Object[] {
[Color=red][b]" * ", " # ", " # "[/b][/color], Character.valueOf('*'Winky Winky, [Color=orange][b]Block.obsidian[/b][/color], Character.valueOf('#'Winky Winky, [Color=orange][b]Item.stick[/b][/color]
});
ModLoader.AddRecipe(new ItemStack(Hoe, 1), new Object[] {
[Color=red][b]"** ", " # ", " # "[/b][/color], Character.valueOf('*'Winky Winky, [Color=orange][b]Block.obsidian[/b][/color], Character.valueOf('#'Winky Winky, [Color=orange][b]Item.stick[/b][/color]
});
ModLoader.AddRecipe(new ItemStack(Sword, 1), new Object[] {
[Color=red][b]" * ", " * ", " # "[/b][/color], Character.valueOf('*'Winky Winky, [Color=orange][b]Block.obsidian[/b][/color], Character.valueOf('#'Winky Winky, [Color=orange][b]Item.stick[/b][/color]
});

RED: These are the recipes! The first set is the top of the crafting bench, the 2nd is the middle row and the 3rd is the last row! * = Obsidian, # = Stick
ORANGE: Ok these current types will create obsidian tools, if you would like to make them like glowstone tools you would, Open up Block.Java, Find the variable for GLOWSTONE
You should find something like: public static final Block glowStone; This means glowStone is what we use, go ahead and replace Obsidian with glowStone! (EXACT CAPS)


Final code:
    package net.minecraft.src;
import java.util.Random;

public class mod_tools extends BaseMod
{

//Here we declare all of our new tools.
public static final Item Pick = new ItemPickaxe(2010, EnumToolMaterial.OBSIDIANTOOL).setItemName("asdf");
public static final Item Spade = new ItemSpade(2009, EnumToolMaterial.OBSIDIANTOOL).setItemName("sdfa");
public static final Item Axe = new ItemAxe(2008, EnumToolMaterial.OBSIDIANTOOL).setItemName("dfas");
public static final Item Hoe = new ItemHoe(2007, EnumToolMaterial.OBSIDIANTOOL).setItemName("fasd");
public static final Item Sword = new ItemSword(2006, EnumToolMaterial.OBSIDIANTOOL).setItemName("adsf");

public mod_tools()
{

//Here we override all the textures, and add our own.
//Make sure the name of your texture is the same what you write here
Pick.iconIndex = ModLoader.addOverride("/gui/items.png", "/Pick.png");
Spade.iconIndex = ModLoader.addOverride("/gui/items.png", "/Spade.png");
Axe.iconIndex = ModLoader.addOverride("/gui/items.png", "/Axe.png");
Hoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/Hoe.png");
Sword.iconIndex = ModLoader.addOverride("/gui/items.png", "/Sword.png");

//Here we add the in game names to all the tools.
ModLoader.AddName(Pick, "Pickaxe");
ModLoader.AddName(Spade, "Shovel");
ModLoader.AddName(Axe, "Axe");
ModLoader.AddName(Hoe, "Hoe");
ModLoader.AddName(Sword, "Sword");

//Here are all the recipes for each tool (all of them are made out of dirt)
ModLoader.AddRecipe(new ItemStack(Pick, 1), new Object[] {
"***", " # ", " # ", Character.valueOf('*'Winky Winky, Block.obsidian, Character.valueOf('#'Winky Winky, Item.stick
});
ModLoader.AddRecipe(new ItemStack(Axe, 1), new Object[] {
"** ", "*# ", " # ", Character.valueOf('*'Winky Winky, Block.obsidian, Character.valueOf('#'Winky Winky, Item.stick
});
ModLoader.AddRecipe(new ItemStack(Spade, 1), new Object[] {
" * ", " # ", " # ", Character.valueOf('*'Winky Winky, Block.obsidian, Character.valueOf('#'Winky Winky, Item.stick
});
ModLoader.AddRecipe(new ItemStack(Hoe, 1), new Object[] {
"** ", " # ", " # ", Character.valueOf('*'Winky Winky, Block.obsidian, Character.valueOf('#'Winky Winky, Item.stick
});
ModLoader.AddRecipe(new ItemStack(Sword, 1), new Object[] {
" * ", " * ", " # ", Character.valueOf('*'Winky Winky, Block.obsidian, Character.valueOf('#'Winky Winky, Item.stick
});
}

public String Version()
{
return "3.14159265";
}
}


[multipage= Step 3: Creating the textures!]
1. Open photoshop!
2. Create a document: 16x16 pixels and designs the tools whatever way you like, I got lazy and just made them solid colors :P You must login or register to view this content.
3. Save them as your file names, in my case, Pick.png, Spade.png, Axe.png, Hoe.png, Sword.png
4. Save them to a place you can remember Smile

[Multipage= Step 4: Creating an OBSIDIAN material!]
Ok rememer how I said we can't edit EnumToolMaterial.OBSIDIANTOOL yet? Well now is the time to do this, Open up your mod_MERK.java file and the java file EnumToolMaterials,
Ok locate
        WOOD("WOOD", 0, 0, 59, 2.0F, 0),
STONE("STONE", 1, 1, 131, 4F, 1),
IRON("IRON", 2, 2, 250, 6F, 2),
EMERALD("EMERALD", 3, 3, 1561, 8F, 3),
GOLD("GOLD", 4, 0, 32, 12F, 0);
And replace it with,
        WOOD("WOOD", 0, 0, 59, 2.0F, 0),
STONE("STONE", 1, 1, 131, 4F, 1),
IRON("IRON", 2, 2, 250, 6F, 2),
EMERALD("EMERALD", 3, 3, 1561, 8F, 3),
GOLD("GOLD", 4, 0, 32, 12F, 0),
OBSIDIANTOOL("OBSIDIANTOOL", [color=red][b]5[/b][/color], [color=blue][b]0[/b][/color], [color=orange][b]2876[/b][/color], [color=green][b]14F[/b][/color], [color=yellow][b]0[/b][/color]);


5: This is the material number, Eg: Stone: 1 IRON: 2 Emerald: 3 GOLSad Awesome 4 OBSIDIANTOOL: 5, Just keep it in order Smile
0: This is it's harvest level, I suggest leaving it at 3 or 2
2876: The amount of uses a tool has, Quite self explanitory
14F: The speed the tool breaks blocks at just edit the 14 to whatever, I don't suggest going too high as 14 is quite quick!
0 Damage vs entity, Just leave it at 0 Smile

Now save both documents and exit out of your text editor! You're done!

[Multipage= Step 5: Recompiling]
1.) Go into your MCP directory and run RECOMPILE.bat
2.) Once it finishes, if there's no errors, go ahead and run Reobfuscate.bat
3.) Once done, open REOBF<MINECRAFT< There should be 2 Classes there! That's good!

[multipage= Step 6: Installing the mod]
Make sure you have ModLoader installed!
Delete META-INF!
Open up your Minecraft.jar with 7-Zip or WinZip, Drag the classes into the main class files Smile Like any other mod,
Next locate your images and do the same, drag them straight in with the classes Smile
Close your archiver and start Minecraft! Congrats, Your tools are now in minecraft!
(adsbygoogle = window.adsbygoogle || []).push({});

The following 4 users say thank you to Merkii for this useful post:

I.Am.Swift, JakeM, lallyman, Pass Word
10-02-2011, 04:11 PM #2
Gaia
Former Staff
I'm surprised a 12y/o knows about this Eek
10-02-2011, 04:11 PM #3
sl1k
Pokemon Trainer
uh-huuuuuuuuuuh?
10-02-2011, 04:16 PM #4
lol i completly suck at java coding so can i just have a link to download this mod?
10-02-2011, 05:23 PM #5
Merkii
Former Staff
Originally posted by xHyPeD View Post
lol i completly suck at java coding so can i just have a link to download this mod?

It's only single player, why would you want a download :l
10-02-2011, 05:25 PM #6
to try it...
10-02-2011, 05:38 PM #7
Merkii
Former Staff
Originally posted by xHyPeD View Post
to try it...

If you insist You must login or register to view this content.
10-02-2011, 06:39 PM #8
do i need mod loader?

The following user groaned Reflection. for this awful post:

JakeM
10-03-2011, 06:02 PM #9
Originally posted by xHyPeD View Post
do i need mod loader?

...Well yeah, it does have "with modloader" in the title

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo