Please visit my main modding topic to vote for what tutorial I should make next.
Table of contents:
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
[goto=generate]Generating Ores[/goto]
[goto=toolset]Creating A New Toolset[/goto]
[goto=armor]Adding A New Set Of Armor[/goto]
[goto=crafting]Adding A Recipe[/goto]
[goto=smelting]Adding A Smelting Recipe[/goto]
...AND MORE
Creating A New Block
Prerequisites
None
Minecraft Version
1.1
Tutorial
In this tutorial, I am going to teach you a new block with ModLoader.
Making a block is the first thing every Minecraft modder learns. Because this is probably the first ModLoader tutorial you have read I will presume the only other tutorial you have read is the ModLoader installation tutorial (Coming Soon!) (I would also suggest you read my modding with Eclipse tutorial (Coming Soon!) and organization with mods tutorial (Coming Soon!) as well).
The first thing you have to do is make a new file that starts with the prefix of mod_. In these tutorials I�m going to be using code straight from my mods (you can get the source code free of charge here: Coming Soon!) so most of my examples are going to say either mod_CamelOre.java. For your mod, you can put whatever you want where I put CamelOre, but it MUST start with mod_ (for example you could have mod_Fish.java). Therefore, you are going to create a new java file called mod_CamelOre.java.
Now that you have mod_CamelOre.java open, you have a blank screen staring at you waiting to be filled up. Here is the basic template that you are going to use for every mod:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public mod_CamelOre()
{
}
public void load()
{
}
public String getVersion()
{
return "1.0.0";
}
}
Just copy and paste that into your mod_CamelOre.java but change the mod_CamelOre�s to whatever your mod is called. The other thing you should do is change is the 1.0.0 to whatever version your mod is (if your mod is Fish Beta 3.1_415 then you would put return �Beta 3.1_415� . The only time the version number will be displayed is if there is an error and Minecraft makes a crash log. This can help you to see if the mod the player is using is up to date. In addition, every file you make has to have package net.minecraft.src; at the top. Your mod_CamelOre must always extend BaseMod (unless your modding for multiplayer (see my ModLoaderMP tutorials here (Coming Soon!))).
Now we can actually start adding the block. The line that we are going to put in our mod_CamelOre is this:
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
Now we are going to go through this systematically.
Public static final: these all tell Java certain things that you do not need to know. All you need to know is you put them at the beginning of this line (for all of you who really want to know, public makes it so other files can use this variable, static means that it is always going to have the same properties so you can make static references to it from other files, and final means that it�s properties can�t be changed).
Block is just saying that it is going to be a block (not an item).
oreTitanium is the name of your ore. Whenever you are going to talk about the ore you are either going to just say oreTitanium, if you are referencing it from mod_CamelOre, or you are going to say mod_CamelOre.oreTitanium if you are referencing from another class (file).
CamelOreBlockOre is a file we are going to make that defines things like what block or item it drops, how many, and other things like what material it is.
123 is the block ID. I am sure you know what a block ID is, but if you do not it is just a number that every block has. Each block has a different block ID. Right now, at 1.0.0, the next free block ID available is 123. Go to minecraftwiki.net and search for block ids to get an up-to-date list of block IDs. Warning: you are block IDs cannot be over 255. 256 and up is reserved for item IDs.
ModLoader.addOverride(�/terrain.png�, �/CamelMod/CamelOre/terrain/titaniumore.png�) defines what texture file is used for this block. �/terrain.png� is the file that it is overriding and it will always be the same if it is a block. �/CamelMod/CamelOre/terrain/titaniumore.png� is the location of your block texture. This block texture has to be 16 pixels by 16 pixels. The texture file is always going to be located in your Minecraft directory/bin/minecraft.jar. For my example, the texture would be located in .minecraft/bin/minecraft.jar/CamelMod/CamelOre/terrain/titaniumore.png. Warning: capitalization matters. When you are testing your mod in MCP, you would be your texture in mcp50/jars/bin/minecraft.jar. Note: there are a limited number of different texture files you can have. Because of this, many people (including me) have started using Minecraft Forge, which offers infinite texture files. You can see my Minecraft Forge tutorials here: Coming Soon!.
setHardness(3F) refers to how hard it is to break the block. Normal ores are 3F. (You do not need to know this but the F makes sure that is a float not an integer (floats can have decimals but integers cannot)).
setResistance(5F) refers to how hard it is to break the block by an explosion. Normal ores are 5F (see above for what the F means).
setStepSound(Block.soundStoneFootstep) is what sound the block makes when you walk on it. The available choices are powder, wood, gravel, grass stone, metal, glass, cloth, and sand.
setBlockName(�oreTitanium�) is mostly used by Notch if he�s setting the in-game name for a block but if you are using ModLoader you don�t use it. Just set it the same name as the block. (If you are modding without ModLoader this is important. See my creating a block tutorial without ModLoader: Coming Soon!).
That took a long time, but that is all the stuff that is crammed into that little statement. Now we just have to put this in the file right before the mod_CamelOre function like this:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public mod_CamelOre()
{
}
public void load()
{
}
public String getVersion()
{
return "1.0.0";
}
}
Ok, now that we have that in our file we still have to do three more things: register the block, give it its in-game name, and create the file CamelOreBlockOre.java. Let us start with registering the block. We just have to add this basic line (not nearly as complicated as the previous line):
ModLoader.RegisterBlock(oreTitanium);</code>
That is it. I really don�t think there is any explaining to do besides tell you where it goes (Note: if you want your block to have damage values, see my damage values tutorial: Coming Soon!). I have to explain something first before I tell you where this goes. The load function that has to be included with every mod_CamelOre file did not exist until Minecraft 1.0.0. Before there was a load function, we put all of this stuff in the mod_CamelOre function. It does not really matter which one you put it in any more, but for the purposes of this tutorial, we are always going to use the load function instead of the mod_CamelOre function. Therefore, that being said, we put that line in our load function so our mod_CamelOre file now looks like this:
[code]package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png").setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
}
public String getVersion()
{
return "1.0.0";
}
}
The next thing we have to do is make an in-game name for our block. To do this we just have to add this line:
ModLoader.AddName(oreTitanium, "Titanium Ore");
This is also self-explanatory. The oreTitanium is the block and �Titanium Ore� is the in-game name. We add this in the same place as our block register, the load function. Now it is going to look like this:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
}
public String getVersion()
{
return "1.0.0";
}
}
That is all we have to do for our mod_CamelOre. Now the last thing that we have to do is make the file CamelOreBlockOre. For now, this file will not do much but you can make your block do special stuff by following my setting properties for your new block tutorial (Coming Soon!). All you have to do is make a new CamelOreBlockOre.java that looks like this:
package net.minecraft.src;
public class CamelOreBlockOre extends Block
{
public CamelOreBlockOre(int i, int j)
{
super(i, j, Material.rock);
}
}
All that is important about this is the material. To choose the right materials just go to my properties for blocks tutorial (Coming Soon!).
Now you have a block that does not generate, is not viewable in creative mode gui, does not smelt, and does not craft into anything. I would highly recommend reading my other tutorials, because I do not want to squeeze any more stuff in here because it is already 1500 words long. Nevertheless, here are some screenshots and my ending code to finish this tutorial off.
Final Code
CamelOreBlockOre.java
package net.minecraft.src;
public class CamelOreBlockOre extends Block
{
public CamelOreBlockOre(int i, int j)
{
super(i, j, Material.rock);
}
}
mod_CamelOre.java
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
}
public String getVersion()
{
return "1.0.0";
}
}
Author
Methuselah96
Creating A New Item
Prerequisites
[goto=block]Creating A New Block[/goto]
Minecraft Version
1.1
Tutorial
In this tutorial I am going to teach you a new item with ModLoader.
I will presume that you have read my ModLoader blocks tutorial mainly for the purpose that adding blocks and items are basically the same just a few changed words which will be explained this tutorial.
We are going to start out with the code we left off with in our block tutorial:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
}
public String getVersion()
{
return "1.0.0";
}
}
We will add this item almost exactly the same way we did for our block by adding this line:
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
If the part of this statement means the same thing for blocks and items I will just say same and you can look at the block tutorial.
Public static final: same
Item is saying it�s going to be an item not a bloock.
ingotTitanium: same
CamelOreItem: same
127: This is the item id, but you will notice if you go on minecraftwiki.net the first item starts at 256 for their id. That�s because Minecraft leaves 0-255 for blocks and 256 to 32256 for items. But, when you are declaring the item id here you do the id minus 256. If I had the titanium ingot id (127) in-game it would be 383. As of 1.0.0 the first non-used item id is 127.
setIconIndex(ModLoader.addOverride(�/gui/items.png�, �/CamelMod/CamelOre/gui/items/titaniumingot.png�): same except it uses the setIconIndex function instead of being next to the item id. Also the first thing in parentheses is /gui/items.png because that is what file it is overriding. Again it has to be 16x16 and you can run out of textures so use Minecraft Forge!
setItemName(�ingotTitanium�): same
That went a lot faster than the last tutorial! We�re going to put this right after our block declaration:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
}
public String getVersion()
{
return "1.0.0";
}
}
Next we have to add it�s in-game name (you don�t have to register items like you do blocks). It works the same way as with a block so explanations needed:
We add it right after our block AddName like this:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
}
public String getVersion()
{
return "1.0.0";
}
}
That�s all in our mod_CamelOre. Now we just have to make the file CamelOreItem. As I said in my block tutorial, this file won�t do much but you can make it do certain things by following my setting properties for your new item tutorial (Coming Soon!). Here it is:
package net.minecraft.src;
public class CamelOreItem extends Item
{
public CamelOreItem(int i)
{
super(i);
}
}
Now you have an item that you can�t get and does not craft into anything. I would highly recommend reading my other tutorials. But here are some screenshots and my ending code to finish this tutorial off.
Final Code
mod_CamelOre.java
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
}
public String getVersion()
{
return "1.0.0";
}
}
CamelOreItem.java
package net.minecraft.src;
public class CamelOreItem extends Item
{
public CamelOreItem(int i)
{
super(i);
}
}
Author
Methuselah96
Generating Ores
Prerequisites
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
Minecraft Version
1.1
Tutorial
In this tutorial I am going to teach you how to make your ores generate. In this tutorial I assume you know how to make a new block and item. If you don�t know how to do this you can read my block and item tutorials: [goto=block]Creating A New Block[/goto] and [goto=item]Creating A New Item[/goto]. This is our starting mod_CamelOre:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
}
public String getVersion()
{
return "1.0.0";
}
}
What we are going to do is generate our titanium ore. This is the function we have to add to do this:
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int l = 0; l < 5; l++)
{
int i1 = chunkX + rand.nextInt(16);
int j1 = rand.nextInt(20);
int k1 = chunkZ + rand.nextInt(16);
(new WorldGenMinable(oreTitanium.blockID, 3)).generate(world, rand, i1, j1, k1);
}
}
Ok, so let�s break this down. First I should make sure you know what a chunk is. A chunk is just any 16x16x128. The 128 is the height.
5 � do you see that 5 in the for statement? That is how many times it tries to make a vein of this ore in one chunk (veins are groups of the same ore i.e. a vein of three blocks would have 3 diamond ores right next to each other). So the higher the number 5 is, the more it�s going to show up.
20 � We�re skipping to 20 because the 16s don�t matter at all. The 20 is what level the ore can be on. If it�s 20 then it would show up from levels 0 � 19. If you didn�t want it to start at 0 you would say level to start with + rand.nextInt(how many levels to show up on) (i.e. 20 + rand.nextInt(20); would make the ore show up on levels 20 � 39.
oreTitanium.blockID is the block that you want to generate. It�s that simple.
3 is how big you want veins to be. WARNING: Veins can�t be lower than 3. If you put in 1 or 2 for the vein number, it will not generate.
That�s it! You�re ore now generates and you can put as many for statements as you want into GenerateSurcface(). Your final mod_CamelOre:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
}
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int l = 0; l < 5; l++)
{
int i1 = chunkX + rand.nextInt(16);
int j1 = rand.nextInt(20);
int k1 = chunkZ + rand.nextInt(16);
(new WorldGenMinable(oreTitanium.blockID, 3)).generate(world, rand, i1, j1, k1);
}
}
public String getVersion()
{
return "1.0.0";
}
}
Final Code
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
}
public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int l = 0; l < 5; l++)
{
int i1 = chunkX + rand.nextInt(16);
int j1 = rand.nextInt(20);
int k1 = chunkZ + rand.nextInt(16);
(new WorldGenMinable(oreTitanium.blockID, 3)).generate(world, rand, i1, j1, k1);
}
}
public String getVersion()
{
return "1.0.0";
}
}
Author
Methuselah96
Creating A New Toolset
Prerequisites
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
Minecraft Version
1.1
Tutorial
In this mod I will be showing you how to add a new tool (when I use the word tool in this tutorial it includes pickaxe, shovel, axe, hoe, and sword) set to Minecraft using ModLoader. This tutorial will be a little bit longer but I have to write it sometime. I assume you know how to make a block and an item. If you don�t know how to do this you can learn how from my tutorials here: [goto=block]Creating A New Block[/goto] and [goto=item]Creating A New Item[/goto].
This is the mod_CamelOre that we start out with that has a titanium ore and a titanium ingot:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
}
public String getVersion()
{
return "1.0.0";
}
}
The first thing you need you need to do is make five new items like this:
public static final Item shovelTitanium = (new CamelOreItemSpade(128, CamelOreEnumToolMaterial.toolTITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumshovel.png").setItemName("shovelTitanium");
public static final Item pickaxeTitanium = (new CamelOreItemPickaxe(129, CamelOreEnumToolMaterial.toolTITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumpickaxe.png").setItemName("pickaxeTitanium");
public static final Item axeTitanium = (new CamelOreItemAxe(130, CamelOreEnumToolMaterial.toolTITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumaxe.png").setItemName("hatchetTitanium");
public static final Item swordTitanium = (new CamelOreItemSword(131, CamelOreEnumToolMaterial.toolTITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumsword.png").setItemName("swordTitanium");
public static final Item hoeTitanium = (new CamelOreItemHoe(132, CamelOreEnumToolMaterial.toolTITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumhoe.png").setItemName("hoeTitanium");
Now there are really only two things I have to explain in this if you have followed my item tutorial. The first is that we have to make six separate files each called CamelOreItem*.java which will match up with the new CamelOreItem* in each statement. The second is that we have to make CamelOreEnumToolMaterial.java too. Our mod_CamelOre now looks like this:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public static final Item shovelTitanium = (new CamelOreItemSpade(128, CamelOreEnumToolMaterial.toolTITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumshovel.png").setItemName("shovelTitanium");
public static final Item pickaxeTitanium = (new CamelOreItemPickaxe(129, CamelOreEnumToolMaterial.toolTITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumpickaxe.png").setItemName("pickaxeTitanium");
public static final Item axeTitanium = (new CamelOreItemAxe(130, CamelOreEnumToolMaterial.toolTITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumaxe.png").setItemName("hatchetTitanium");
public static final Item swordTitanium = (new CamelOreItemSword(131, CamelOreEnumToolMaterial.toolTITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumsword.png").setItemName("swordTitanium");
public static final Item hoeTitanium = (new CamelOreItemHoe(132, CamelOreEnumToolMaterial.toolTITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumhoe.png").setItemName("hoeTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
}
public String getVersion()
{
return "1.0.0";
}
}
We have to do two other things to our mod_CamelOre which I am not going to explain. We have to add names for our tools and make recipes for them. If you don�t know how to do those things you can learn how in my block and crafting recipe tutorials respectively: [goto=block]Creating A New Block[/goto] and [goto=crafting]Adding A Recipe[/goto]. Here it is:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public static final Item shovelTitanium = (new CamelOreItemSpade(128, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumshovel.png").setItemName("shovelTitanium");
public static final Item pickaxeTitanium = (new CamelOreItemPickaxe(129, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumpickaxe.png").setItemName("pickaxeTitanium");
public static final Item axeTitanium = (new CamelOreItemAxe(130, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumaxe.png").setItemName("hatchetTitanium");
public static final Item swordTitanium = (new CamelOreItemSword(131, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumsword.png").setItemName("swordTitanium");
public static final Item hoeTitanium = (new CamelOreItemHoe(132, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumhoe.png").setItemName("hoeTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
ModLoader.AddName(shovelTitanium, "Titanium Shovel");
ModLoader.AddName(pickaxeTitanium, "Titanium Pickaxe");
ModLoader.AddName(axeTitanium, "Titanium Axe");
ModLoader.AddName(swordTitanium, "Titanium Sword");
ModLoader.AddName(hoeTitanium, "Titanium Hoe");
ModLoader.AddRecipe(new ItemStack(pickaxeTitanium), new Object[] {"XXX", " # ", " # ", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
ModLoader.AddRecipe(new ItemStack(shovelTitanium), new Object[] {"X", "#", "#", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
ModLoader.AddRecipe(new ItemStack(axeTitanium), new Object[] {"XX", "X#", " #", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
ModLoader.AddRecipe(new ItemStack(hoeTitanium), new Object[] {"XX", " #", " #", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
ModLoader.AddRecipe(new ItemStack(swordTitanium), new Object[] {"X", "X", "#", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
}
public String getVersion()
{
return "1.0.0";
}
}
Now we just have seven files left! Let�s start with CamelOreEnumToolMaterial. Here it is:
>package net.minecraft.src;
public enum CamelOreEnumToolMaterial
{
TITANIUM("TITANIUM", 5, 2, 500, 7F, 3, 9);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private static final CamelOreEnumToolMaterial allToolMaterials[];
private CamelOreEnumToolMaterial(String s, int i, int j, int k, float f, int l, int i1)
{
harvestLevel = j;
maxUses = k;
efficiencyOnProperMaterial = f;
damageVsEntity = l;
enchantability = i1;
}
public int getMaxUses()
{
return maxUses;
}
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
public int getDamageVsEntity()
{
return damageVsEntity;
}
public int getHarvestLevel()
{
return harvestLevel;
}
public int getEnchantability()
{
return enchantability;
}
static
{
allToolMaterials = (new CamelOreEnumToolMaterial[] {
TITANIUM
});
}
}
There are really only three (six) things you have to pay attention to in this file.
Change all the CamelOreEnumToolMaterials� to whatever your file is called (there are 4 of them).
The line that say TITANIUM on it. It should have the name of your tool material in all caps. If there are more than one, then separate them by a comma.
We have to break down the TITANIUM line at the top of this file.
Here�s that breakdown:
�TITANIUM� is just the name of your tool material. (the original ones are �WOOD�, �STONE�, �IRON�, �EMERALD�, �GOLD� (they are referenced in the rest of this breakdown in the same order as here))
5 is like a block ID except it is a tool material id (0, 1, 2, 3, 4)
2 is the harvest level which defines what breaks it can break and which it can�t. (3 - obsidian, 2 - diamond, gold, and redstone, 1 - iron and lapis) (0, 1, 2, 3, 0)
500 is its maximum uses or how many times it can be used before it breaks (59, 131, 250, 1561, 32)
7F is its efficiency on proper material or how much faster it can mine stuff than usual if it is for that tool (pickaxe - cobblestone, stairs, stone, sand stone, mossy cobblestone, iron, coal, gold, diamond, ice, netherrack lapis, redstone, and rails. shovel - grass, dirt, sand, gravel, snow, clay, slow sand. axe - planks, wood, bookshelf, chest, stairs, and pumpkins) (2F, 4F, 6F, 8F, 12F)
3 is its damage vs entities or how much damage it does to entities. (0, 1, 2, 3, 0)
9 is its enchantibility level or how enchantible it is (15, 5, 14, 10, 22)
If you wanted to do more than one tool material up there you would just put a comma instead of a semicolon and put another one. We�re done with that file!
Now we have six left. But its not that bad. What we have to do is copy each original file and just change all the Item* to CamelOreItem* and all the EnumToolMaterial to CamelOreEnumToolMaterial We�re just going to look at one of them and then I�ll just give you the other five because you will know what they all mean. Here is CamelOreItemAxe:
The only thing you have to change in this file is CamelOreEnumToolMaterial to whatever your file is called. Then if you�re copying it to other files you just have to change the CamelOreItemAxe and CamelOreItemTool to CamelOreItemHoe, CamelOreItemPickaxe, CamelOreItemSpade, or CamelOreItemSword. Here are the other files to wrap up this tutorial:
CamelOreItemHoe:
package net.minecraft.src;
public class CamelOreItemHoe extends Item
{
public CamelOreItemHoe(int i, CamelOreEnumToolMaterial enumtoolmaterial)
{
super(i);
maxStackSize = 1;
setMaxDamage(enumtoolmaterial.getMaxUses());
}
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
{
if(!entityplayer.func_35190_e(i, j, k))
{
return false;
}
int i1 = world.getBlockId(i, j, k);
int j1 = world.getBlockId(i, j + 1, k);
if(l != 0 && j1 == 0 && i1 == Block.grass.blockID || i1 == Block.dirt.blockID)
{
Block block = Block.tilledField;
world.playSoundEffect((float)i + 0.5F, (float)j + 0.5F, (float)k + 0.5F, block.stepSound.stepSoundDir2(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if(world.multiplayerWorld)
{
return true;
} else
{
world.setBlockWithNotify(i, j, k, block.blockID);
itemstack.damageItem(1, entityplayer);
return true;
}
} else
{
return false;
}
}
public boolean isFull3D()
{
return true;
}
}
package net.minecraft.src;
public class CamelOreItemSpade extends CamelOreItemTool
{
private static Block blocksEffectiveAgainst[];
public CamelOreItemSpade(int i, CamelOreEnumToolMaterial enumtoolmaterial)
{
super(i, 1, enumtoolmaterial, blocksEffectiveAgainst);
}
public boolean canHarvestBlock(Block block)
{
if(block == Block.snow)
{
return true;
}
return block == Block.blockSnow;
}
static
{
blocksEffectiveAgainst = (new Block[] {
Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium
});
}
}
CamelOreItemSword:
package net.minecraft.src;
public class CamelOreItemSword extends CamelOreItem
{
private int weaponDamage;
private final CamelOreEnumToolMaterial field_40439_b;
public CamelOreItemSword(int i, CamelOreEnumToolMaterial enumtoolmaterial)
{
super(i);
field_40439_b = enumtoolmaterial;
maxStackSize = 1;
setMaxDamage(enumtoolmaterial.getMaxUses());
weaponDamage = 4 + enumtoolmaterial.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack itemstack, Block block)
{
return block.blockID != Block.web.blockID ? 1.5F : 15F;
}
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(1, entityliving1);
return true;
}
public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
{
itemstack.damageItem(2, entityliving);
return true;
}
public int getDamageVsEntity(Entity entity)
{
return weaponDamage;
}
public boolean isFull3D()
{
return true;
}
public EnumAction getItemUseAction(ItemStack itemstack)
{
return EnumAction.block;
}
public int getMaxItemUseDuration(ItemStack itemstack)
{
return 0x11940;
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
return itemstack;
}
public boolean canHarvestBlock(Block block)
{
return block.blockID == Block.web.blockID;
}
public int getItemEnchantability()
{
return field_40439_b.getEnchantability();
}
}
CamelOreItemTool:
package net.minecraft.src;
import java.util.Arrays;
public class CamelOreItemTool extends Item
{
private Block blocksEffectiveAgainst[];
public float efficiencyOnProperMaterial;
public int damageVsEntity;
protected CamelOreEnumToolMaterial toolMaterial;
protected CamelOreItemTool(int i, int j, CamelOreEnumToolMaterial enumtoolmaterial, Block ablock[])
{
super(i);
efficiencyOnProperMaterial = 4F;
toolMaterial = enumtoolmaterial;
blocksEffectiveAgainst = ablock;
maxStackSize = 1;
setMaxDamage(enumtoolmaterial.getMaxUses());
efficiencyOnProperMaterial = enumtoolmaterial.getEfficiencyOnProperMaterial();
damageVsEntity = j + enumtoolmaterial.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack itemstack, Block block)
{
for(int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if(blocksEffectiveAgainst[i] == block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(2, entityliving1);
return true;
}
public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
{
itemstack.damageItem(1, entityliving);
return true;
}
public int getDamageVsEntity(Entity entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
Final Code
mod_CamelOre.java
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png").setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public static final Item shovelTitanium = (new CamelOreItemSpade(128, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumshovel.png").setItemName("shovelTitanium");
public static final Item pickaxeTitanium = (new CamelOreItemPickaxe(129, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumpickaxe.png")).setItemName("pickaxeTitanium");
public static final Item axeTitanium = (new CamelOreItemAxe(130, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumaxe.png").setItemName("hatchetTitanium");
public static final Item swordTitanium = (new CamelOreItemSword(131, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumsword.png").setItemName("swordTitanium");
public static final Item hoeTitanium = (new CamelOreItemHoe(132, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumhoe.png").setItemName("hoeTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
ModLoader.AddName(shovelTitanium, "Titanium Shovel");
ModLoader.AddName(pickaxeTitanium, "Titanium Pickaxe");
ModLoader.AddName(axeTitanium, "Titanium Axe");
ModLoader.AddName(swordTitanium, "Titanium Sword");
ModLoader.AddName(hoeTitanium, "Titanium Hoe");
ModLoader.AddRecipe(new ItemStack(pickaxeTitanium), new Object[] {"XXX", " # ", " # ", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
ModLoader.AddRecipe(new ItemStack(shovelTitanium), new Object[] {"X", "#", "#", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
ModLoader.AddRecipe(new ItemStack(axeTitanium), new Object[] {"XX", "X#", " #", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
ModLoader.AddRecipe(new ItemStack(hoeTitanium), new Object[] {"XX", " #", " #", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
ModLoader.AddRecipe(new ItemStack(swordTitanium), new Object[] {"X", "X", "#", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
}
public String getVersion()
{
return "1.0.0";
}
}
CamelOreEnumToolMaterial
package net.minecraft.src;
public enum CamelOreEnumToolMaterial
{
TITANIUM("TITANIUM", 5, 2, 500, 7F, 3, 9);
private final int harvestLevel;
private final int maxUses;
private final float efficiencyOnProperMaterial;
private final int damageVsEntity;
private final int enchantability;
private static final CamelOreEnumToolMaterial allToolMaterials[];
private CamelOreEnumToolMaterial(String s, int i, int j, int k, float f, int l, int i1)
{
harvestLevel = j;
maxUses = k;
efficiencyOnProperMaterial = f;
damageVsEntity = l;
enchantability = i1;
}
public int getMaxUses()
{
return maxUses;
}
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
public int getDamageVsEntity()
{
return damageVsEntity;
}
public int getHarvestLevel()
{
return harvestLevel;
}
public int getEnchantability()
{
return enchantability;
}
static
{
allToolMaterials = (new CamelOreEnumToolMaterial[] {
TITANIUM
});
}
}
package net.minecraft.src;
public class CamelOreItemSpade extends CamelOreItemTool
{
private static Block blocksEffectiveAgainst[];
public CamelOreItemSpade(int i, CamelOreEnumToolMaterial enumtoolmaterial)
{
super(i, 1, enumtoolmaterial, blocksEffectiveAgainst);
}
public boolean canHarvestBlock(Block block)
{
if(block == Block.snow)
{
return true;
}
return block == Block.blockSnow;
}
static
{
blocksEffectiveAgainst = (new Block[] {
Block.grass, Block.dirt, Block.sand, Block.gravel, Block.snow, Block.blockSnow, Block.blockClay, Block.tilledField, Block.slowSand, Block.mycelium
});
}
}
CamelOreItemSword
package net.minecraft.src;
public class CamelOreItemSword extends CamelOreItem
{
private int weaponDamage;
private final CamelOreEnumToolMaterial field_40439_b;
public CamelOreItemSword(int i, CamelOreEnumToolMaterial enumtoolmaterial)
{
super(i);
field_40439_b = enumtoolmaterial;
maxStackSize = 1;
setMaxDamage(enumtoolmaterial.getMaxUses());
weaponDamage = 4 + enumtoolmaterial.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack itemstack, Block block)
{
return block.blockID != Block.web.blockID ? 1.5F : 15F;
}
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(1, entityliving1);
return true;
}
public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
{
itemstack.damageItem(2, entityliving);
return true;
}
public int getDamageVsEntity(Entity entity)
{
return weaponDamage;
}
public boolean isFull3D()
{
return true;
}
public EnumAction getItemUseAction(ItemStack itemstack)
{
return EnumAction.block;
}
public int getMaxItemUseDuration(ItemStack itemstack)
{
return 0x11940;
}
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
{
entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
return itemstack;
}
public boolean canHarvestBlock(Block block)
{
return block.blockID == Block.web.blockID;
}
public int getItemEnchantability()
{
return field_40439_b.getEnchantability();
}
}
CamelOreItemTool
package net.minecraft.src;
import java.util.Arrays;
public class CamelOreItemTool extends Item
{
private Block blocksEffectiveAgainst[];
public float efficiencyOnProperMaterial;
public int damageVsEntity;
protected CamelOreEnumToolMaterial toolMaterial;
protected CamelOreItemTool(int i, int j, CamelOreEnumToolMaterial enumtoolmaterial, Block ablock[])
{
super(i);
efficiencyOnProperMaterial = 4F;
toolMaterial = enumtoolmaterial;
blocksEffectiveAgainst = ablock;
maxStackSize = 1;
setMaxDamage(enumtoolmaterial.getMaxUses());
efficiencyOnProperMaterial = enumtoolmaterial.getEfficiencyOnProperMaterial();
damageVsEntity = j + enumtoolmaterial.getDamageVsEntity();
}
public float getStrVsBlock(ItemStack itemstack, Block block)
{
for(int i = 0; i < blocksEffectiveAgainst.length; i++)
{
if(blocksEffectiveAgainst[i] == block)
{
return efficiencyOnProperMaterial;
}
}
return 1.0F;
}
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(2, entityliving1);
return true;
}
public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
{
itemstack.damageItem(1, entityliving);
return true;
}
public int getDamageVsEntity(Entity entity)
{
return damageVsEntity;
}
public boolean isFull3D()
{
return true;
}
public int getItemEnchantability()
{
return toolMaterial.getEnchantability();
}
}
Author
Methuselah96
Adding A New Set Of Armor
Prerequisites
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
Minecraft Version
1.1
Tutorial
In this tutorial I am going to teach you how to make a new set of armor. I assume you already know how to make a new block and item. If you don�t you can read those tutorials here: [goto=block]Creating A New Block[/goto] and [goto=item]Creating A New Item[/goto].
This is the mod_CamelOre that we start out with that has a titanium ore and a titanium ingot:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
}
public String getVersion()
{
return "1.0.0";
}
}
The first thing you need you need to do is make four new items like this:
public static final Item helmetTitanium = (new CamelOreItemArmor(128, CamelOreEnumArmorMaterial.TITANIUM, ModLoader.AddArmor("titanium"), 0)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumhelmet.png").setItemName("helmetTitanium");
public static final Item plateTitanium = (new CamelOreItemArmor(129, CamelOreEnumArmorMaterial.TITANIUM, ModLoader.AddArmor("titanium"), 1)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumchestplate.png").setItemName("chestplateTitanium");
public static final Item legsTitanium = (new CamelOreItemArmor(130, CamelOreEnumArmorMaterial.TITANIUM, ModLoader.AddArmor("titanium"), 2)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumleggings.png").setItemName("leggingsTitanium");
public static final Item bootsTitanium = (new CamelOreItemArmor(131, CamelOreEnumArmorMaterial.TITANIUM, ModLoader.AddArmor("titanium"), 3)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumboots.png").setItemName("bootsTitanium");
Now there are really only three things I have to explain in this if you have followed my item tutorial. The first is that we have to make a file called CamelOreItemArmor.java which will match up with the new CamelOreItemArmor in each statement. The second is that we have to make CamelOreArmorToolMaterial.java, too. The last is that ModLoader.AddArmor(�titanium�) means that you will need to make two new texture files in minecraft.jar/armor/ called titanium_1.png and titanium_2.png. These texture files are what the armor looks like when it�s being worn by a player and it should have the same format as the other armor texture files. So basically whatever �titanium� is, is what the name of the image file will be. It will always automatically be located in minecraft.jar/armor. Our mod_CamelOre now looks like this:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public static final Item helmetTitanium = (new CamelOreItemArmor(128, CamelOreEnumArmorMaterial.TITANIUM, ModLoader.AddArmor("titanium"), 0)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumhelmet.png").setItemName("helmetTitanium");
public static final Item plateTitanium = (new CamelOreItemArmor(129, CamelOreEnumArmorMaterial.TITANIUM, ModLoader.AddArmor("titanium"), 1)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumchestplate.png").setItemName("chestplateTitanium");
public static final Item legsTitanium = (new CamelOreItemArmor(130, CamelOreEnumArmorMaterial.TITANIUM, ModLoader.AddArmor("titanium"), 2)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumleggings.png").setItemName("leggingsTitanium");
public static final Item bootsTitanium = (new CamelOreItemArmor(131, CamelOreEnumArmorMaterial.TITANIUM, ModLoader.AddArmor("titanium"), 3)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumboots.png").setItemName("bootsTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
}
public String getVersion()
{
return "1.0.0";
}
}
We have to do two other things to our mod_CamelOre which I am not going to explain. We have to add names for our tools and make recipes for them. If you don�t know how to do those things you can learn how in my block and crafting recipe tutorials respectively: . Here it is:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public static final Item shovelTitanium = (new CamelOreItemSpade(128, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumshovel.png").setItemName("shovelTitanium");
public static final Item pickaxeTitanium = (new CamelOreItemPickaxe(129, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumpickaxe.png").setItemName("pickaxeTitanium");
public static final Item axeTitanium = (new CamelOreItemAxe(130, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumaxe.png").setItemName("hatchetTitanium");
public static final Item swordTitanium = (new CamelOreItemSword(131, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumsword.png").setItemName("swordTitanium");
public static final Item hoeTitanium = (new CamelOreItemHoe(132, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumhoe.png").setItemName("hoeTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
ModLoader.AddName(helmetTitanium, "Titanium Helmet");
ModLoader.AddName(plateTitanium, "Titanium Chestplate");
ModLoader.AddName(legsTitanium, "Titanium Leggings");
ModLoader.AddName(bootsTitanium, "Titanium Boots"); ModLoader.AddRecipe(new ItemStack(helmetTitanium), new Object[] {"XXX", "X X", Character.valueOf('X'), ingotTitanium});
ModLoader.AddRecipe(new ItemStack(plateTitanium), new Object[] {"X X", "XXX", "XXX", Character.valueOf('X'), ingotTitanium
ModLoader.AddRecipe(new ItemStack(legsTitanium), new Object[] {"XXX", "X X", "X X", Character.valueOf('X'), ingotTitanium
ModLoader.AddRecipe(new ItemStack(bootsTitanium), new Object[] {"X X", "X X", Character.valueOf('X'), ingotTitanium});
}
public String getVersion()
{
return "1.0.0";
}
}
Now we just have two files left! Let�s start with CamelOreEnumArmorMaterial. Here it is:
package net.minecraft.src;
public enum CamelOreEnumArmorMaterial
{
TITANIUM("TITANIUM", 5, 29, new int[] {2, 7, 5, 3}, 9);
private int maxDamageFactor;
private int damageReductionAmountArray[];
private int enchantability;
private static final CamelOreEnumArmorMaterial allArmorMaterials[];
private CamelOreEnumArmorMaterial(String s, int i, int j, int ai[], int k)
{
maxDamageFactor = j;
damageReductionAmountArray = ai;
enchantability = k;
}
public int func_40576_a(int i)
{
return ItemArmor.getMaxDamageArray()[i] * maxDamageFactor;
}
public int getDamageReductionAmount(int i)
{
return damageReductionAmountArray[i];
}
public int getEnchantability()
{
return enchantability;
}
static
{
allArmorMaterials = (new CamelOreEnumArmorMaterial[] {
TITANIUM
});
}
}
There are really only three (six) things you have to pay attention to in this file.
Change all the CamelOreEnumArmorMaterials� to whatever your file is called (there are 4 of them).
The line that say TITANIUM on it. It should have the name of your armor material in all caps. If there are more than one, then separate them by a comma.
We have to break down the TITANIUM line at the top of this file.
Here�s that breakdown:
�TITANIUM� is just the name of your armor material. (the original ones are �CLOTH�, �CHAIN�, �IRON�, �GOLD�, �DIAMOND� (they are referenced in the rest of this breakdown in the same order as here))
5 is like a block ID except it is a armor material ID (0, 1, 2, 3, 4)
29 is its maximum use factor or how many times it can be used (multiplied by a number, that you can�t define, depending on which piece of armor it is) before it breaks (5, 15, 15, 7, 33)
2, 7, 5, 3 are how much damage it absorbs for each type. The first number is helmet, then chestplate, leggings, and then boots. (1, 3, 2, 1 � 2, 5, 4, 1 � 2, 6, 5, 2 � 2, 5, 3, 1 � 3, 8, 6, 3)
9 is its enchantibility level or how enchantible it is (15, 12, 9, 25, 10)
If you wanted to do more than one armor material up there you would just put a comma instead of a semicolon and put another one. We�re done with that file!
Now we only have one left. Here is CamelOreItemArmor:
package net.minecraft.src;
public class CamelOreItemArmor extends ItemArmor
{
private static final int maxDamageArray[] = {
11, 16, 15, 13
};
public final int armorType;
public final int damageReduceAmount;
public final int renderIndex;
private final CamelOreEnumArmorMaterial material;
public ItemArmor(int i, CamelOreEnumArmorMaterial enumarmormaterial, int j, int k)
{
super(i, EnumArmorMaterial.CLOTH, j, k);
material = enumarmormaterial;
armorType = k;
renderIndex = j;
damageReduceAmount = enumarmormaterial.getDamageReductionAmount(k);
setMaxDamage(enumarmormaterial.func_40576_a(k));
maxStackSize = 1;
}
public int getItemEnchantability()
{
return material.getEnchantability();
}
static int[] getMaxDamageArray()
{
return maxDamageArray;
}
}
Final Code
mod_CamelOre.java
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public static final Item shovelTitanium = (new CamelOreItemSpade(128, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumshovel.png").setItemName("shovelTitanium");
public static final Item pickaxeTitanium = (new CamelOreItemPickaxe(129, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumpickaxe.png").setItemName("pickaxeTitanium");
public static final Item axeTitanium = (new CamelOreItemAxe(130, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumaxe.png").setItemName("hatchetTitanium");
public static final Item swordTitanium = (new CamelOreItemSword(131, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumsword.png").setItemName("swordTitanium");
public static final Item hoeTitanium = (new CamelOreItemHoe(132, CamelOreEnumToolMaterial. TITANIUM)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumhoe.png").setItemName("hoeTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
ModLoader.AddName(helmetTitanium, "Titanium Helmet");
ModLoader.AddName(plateTitanium, "Titanium Chestplate");
ModLoader.AddName(legsTitanium, "Titanium Leggings");
ModLoader.AddName(bootsTitanium, "Titanium Boots"); ModLoader.AddRecipe(new ItemStack(helmetTitanium), new Object[] {"XXX", "X X", Character.valueOf('X'), ingotTitanium});
ModLoader.AddRecipe(new ItemStack(plateTitanium), new Object[] {"X X", "XXX", "XXX", Character.valueOf('X'), ingotTitanium
ModLoader.AddRecipe(new ItemStack(legsTitanium), new Object[] {"XXX", "X X", "X X", Character.valueOf('X'), ingotTitanium
ModLoader.AddRecipe(new ItemStack(bootsTitanium), new Object[] {"X X", "X X", Character.valueOf('X'), ingotTitanium});
}
public String getVersion()
{
return "1.0.0";
}
}
CamelOreItemArmor.java:
package net.minecraft.src;
public class CamelOreItemArmor extends ItemArmor
{
private static final int maxDamageArray[] = {
11, 16, 15, 13
};
public final int armorType;
public final int damageReduceAmount;
public final int renderIndex;
private final CamelOreEnumArmorMaterial material;
public ItemArmor(int i, CamelOreEnumArmorMaterial enumarmormaterial, int j, int k)
{
super(i, EnumArmorMaterial.CLOTH, j, k);
material = enumarmormaterial;
armorType = k;
renderIndex = j;
damageReduceAmount = enumarmormaterial.getDamageReductionAmount(k);
setMaxDamage(enumarmormaterial.func_40576_a(k));
maxStackSize = 1;
}
public int getItemEnchantability()
{
return material.getEnchantability();
}
static int[] getMaxDamageArray()
{
return maxDamageArray;
}
}
Author
Methuselah96
Adding A Recipe
Prerequisites
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
Minecraft Version
1.1
Tutorial
In this tutorial I am going to teach you how to make a new crafting recipe with ModLoader. I assume you know how to make a new block and item. If you don�t you can read how to here: [goto=block]Creating A New Block[/goto and [goto=item]Creating A New Item[/goto].
There is two different kinds of recipes you can add: regular recipes and shapeless recipes. I am going to start with regular recipes.
As an example I�m going to show you how to craft minecart tracks, but with titanium instead of iron. Here is the mod_CamelOre that we are starting with:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
}
public String getVersion()
{
return "1.0.0";
}
}
new ItemStack(Block.rail, 16) - this is what the recipe is going to output. The result of this crafting is that the player will get 16 minecart tracks. If you wanted to reference to a block that you have modded into the game, you wouldn�t put the Block. in front of it. You would just say rail. The 16 is how many there are. You can also add damage values by putting a comma after 16 and then putting the damage value want (i.e. (Block.wood, 16, 2)).
�X X�, �X#X�, �X X� - this is what the recipe acutally looks like. Each space means there is nothing. X and # can be whatever characters you want because we deifine what each one means later in the stament. It could be �3 3�, �353 �3 3�. Also, you can just give two rows like this: �XXX�, �XXX�. That would make it so that the recipe can start on the top row or the bottom row. In other words you could have the top row and the middle row of the same stuff and it would make a minecart track, or you could have the middle row and the bottom row full and it would also give you a minecart track. The last thing I want to show you is if it also doesn�t matter where it is horizontally either. You could have �XX�, �XX� and you just need a 2x2 block anywhere on the crafting grid and it would give you a minecart track. Same goes for just one block. You would just put �X�. And you could put that one block anywhere in the crafting grid to get the minecart track.
Character.valueOf(�X�), ingotTitanium, Character.valueOf(�#�), Item.stick - This makes it so that whenever X shows up in the recipe pattern it has to be a titanium ingot and whenever # shows up in the recipe it has to be a stick. Again when it is a modded block/item you don�t have to put Block./Item. in front of it. Also again, you can make X and # whatever you want and you can have as many different characters as you want.
All this will make our mod_CamelOre look like this:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
ModLoader.AddRecipe(new ItemStack(Block.rail, 16), new Object[] {"X X", "X#X", "X X", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
}
public String getVersion()
{
return "1.0.0";
}
}
Now that we�re done doing a regular recipe it�s time for a shapeless recipe. First I should explain what a shapeless recipe is. Shapeless recipes are recipes that have two or more ingredients where those two ingredients can be placed wherever they want in the crafting grid to get a result. The most basic example are dyes. You can place two dyes wherever you want to get a new dye (in most cases). All of the rules are the same except there is no pattern. I�m going to do a really pointless one just for example and then this tutorial will be over:
ModLoader.AddShapelessRecipe(new ItemStack(Block.dirt), new Object[] {ingotTitanium, Block.sand});
There you go. I don�t think you really need an explanation for that besides that there is no recipe pattern. Here is our final mod_CamelOre:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
ModLoader.AddRecipe(new ItemStack(Block.rail, 16), new Object[] {"X X", "X#X", "X X", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
ModLoader.AddShapelessRecipe(new ItemStack(Block.dirt), new Object[] {ingotTitanium, Block.sand});
}
public String getVersion()
{
return "1.0.0";
}
}
Final Code
mod_CamelOre.java
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
ModLoader.AddRecipe(new ItemStack(Block.rail, 16), new Object[] {"X X", "X#X", "X X", Character.valueOf('X'), ingotTitanium, Character.valueOf('#'), Item.stick});
ModLoader.AddShapelessRecipe(new ItemStack(Block.dirt), new Object[] {ingotTitanium, Block.sand});
}
public String getVersion()
{
return "1.0.0";
}
}
Author
Methuselah96
Adding A Smelting Recipe
Prerequisites
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
Minecraft Version
1.1
Tutorial
In this tutorial I am going to teach you how to make a furnace recipe. I assume you know how to make a basic block and item. If you don�t you can read my tutorial here: [goto=block]Creating A New Block[/goto] and [goto=item]Creating A New Item[/goto].
Here is the mod_CamelOre that we are starting with:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
}
public String getVersion()
{
return "1.0.0";
}
}
This is the basic line that we are going to add that smelt a titanium ore in to a titanium ingot:
ModLoader.AddSmelting(oreTitanium.blockID, new ItemStack(ingotTitanium));
oreTitanium.blockID is the ingredient for the furnace recipe. If you were doing an item you would use .shiftedIndex instead of .blockID. If it is a non-modded block/item then you would put Block.dirt.blockID or Item.dye.shiftedIndex, but with modded blocks/items you just omit that prefix of Block./Item.. It is impossible to make the ingredient have a damage value without editing base classes. ingotTitanium is the result of the smelting. You use it the same way except you omit the suffix of .blockID/.shiftedIndex. Your final mod_CamelOre will look like this:
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
ModLoader.AddSmelting(oreTitanium.blockID, new ItemStack(ingotTitanium));
}
public String getVersion()
{
return "1.0.0";
}
}
Final Code
mod_CamelOre.java
package net.minecraft.src;
public class mod_CamelOre extends BaseMod
{
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png")).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
public static final Item ingotTitanium = (new CamelOreItem(127)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/CamelMod/CamelOre/gui/items/titaniumingot.png").setItemName("ingotTitanium");
public mod_CamelOre()
{
}
public void load()
{
ModLoader.RegisterBlock(oreTitanium);
ModLoader.AddName(oreTitanium, "Titanium Ore");
ModLoader.AddName(ingotTitanium, "Titanium Ingot");
ModLoader.AddSmelting(oreTitanium.blockID, new ItemStack(ingotTitanium));
}
public String getVersion()
{
return "1.0.0";
}
}
Like Options menu and Main Menu guis. You see, I'm working on a gui mod and was wondering if it's possible to add and delete buttons and text, using modloader.
Could you do a tutorial on making a new dimension? I had the gist of it in 1.8.1 but I've since forgotten.
The pieces would be:
*Transportation to another dimension (portals)
*Basic terrain generation (a modified version of the generating ores tutorial I believe)
*Registering mob spawns to the dimension
Rollback Post to RevisionRollBack
Currently working on random projects. Have any coding problems? Feel free to PM!
Could you do a tutorial on making a new dimension? I had the gist of it in 1.8.1 but I've since forgotten.
The pieces would be:
*Transportation to another dimension (portals)
*Basic terrain generation (a modified version of the generating ores tutorial I believe)
*Registering mob spawns to the dimension
do you want this new dimension to be multi-biome or just like one biome?
do you want this new dimension to be multi-biome or just like one biome?
Biomes would be a good thing to incorporate as well. The more comprehensive a tutorial the better imo. Probably could make a separate tutorial on how to make a biome and list it as a prerequisite. Sorry I'm piling this all on, I would help if I had the ability to...
Rollback Post to RevisionRollBack
Currently working on random projects. Have any coding problems? Feel free to PM!
You do realize thet writing :
"super(i, EnumArmorMaterial.CLOTH, j, k);" (In somethingItemArmor)
is the same as writing :
"public static final Item ArmorSomething= (new ItemArmor(3000, EnumArmorMaterial.CLOTH, ModLoader.AddArmor("Something"), 1)).setItemName("Something");"
Just saying, besides thet grate tut's thx for all of them man
well i think you forgot to add one bracket in the Creating A New Block tut
public static final Block oreTitanium = new CamelOreBlockOre(123, ModLoader.addOverride("/terrain.png", "/CamelMod/CamelOre/terrain/titaniumore.png").setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("oreTitanium");
after the titaniumore.png") you should add one more bracket other wise it wont let you use the functions cause its not declered object from what i understand (that was the way i fixed the eror in my script maybe i dont understand something and i done it wrong but i am pretty sure you forgote to close the bracket
...For some reason, when ever I copy your code into Eclipse and edit it all (even before I do so) Eclipse bugs out on me and points out a bunch of errors to me...So are there a bunch of errors in this code that I need to fix (it always says that I need to add another ")", but I never know where to put it, even if I have to....
Could you please revise your code on this tutorial, fix it if needed, and make it simpler where possible, since your tutorials are all on one page, easy to find, and have everything I need...
(Seriously, I've tried almost all of your tutorials, from blocks to items to armour, and then I go to an older modloader tutorial for armor, and it doesn't shoot up any errors)
Table of contents:
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
[goto=generate]Generating Ores[/goto]
[goto=toolset]Creating A New Toolset[/goto]
[goto=armor]Adding A New Set Of Armor[/goto]
[goto=crafting]Adding A Recipe[/goto]
[goto=smelting]Adding A Smelting Recipe[/goto]
...AND MORE
Creating A New Block
Prerequisites
None
Minecraft Version
1.1
Tutorial
In this tutorial, I am going to teach you a new block with ModLoader.
Making a block is the first thing every Minecraft modder learns. Because this is probably the first ModLoader tutorial you have read I will presume the only other tutorial you have read is the ModLoader installation tutorial (Coming Soon!) (I would also suggest you read my modding with Eclipse tutorial (Coming Soon!) and organization with mods tutorial (Coming Soon!) as well).
The first thing you have to do is make a new file that starts with the prefix of mod_. In these tutorials I�m going to be using code straight from my mods (you can get the source code free of charge here: Coming Soon!) so most of my examples are going to say either mod_CamelOre.java. For your mod, you can put whatever you want where I put CamelOre, but it MUST start with mod_ (for example you could have mod_Fish.java). Therefore, you are going to create a new java file called mod_CamelOre.java.
Now that you have mod_CamelOre.java open, you have a blank screen staring at you waiting to be filled up. Here is the basic template that you are going to use for every mod:
Just copy and paste that into your mod_CamelOre.java but change the mod_CamelOre�s to whatever your mod is called. The other thing you should do is change is the 1.0.0 to whatever version your mod is (if your mod is Fish Beta 3.1_415 then you would put return �Beta 3.1_415� . The only time the version number will be displayed is if there is an error and Minecraft makes a crash log. This can help you to see if the mod the player is using is up to date. In addition, every file you make has to have package net.minecraft.src; at the top. Your mod_CamelOre must always extend BaseMod (unless your modding for multiplayer (see my ModLoaderMP tutorials here (Coming Soon!))).
Now we can actually start adding the block. The line that we are going to put in our mod_CamelOre is this:
Now we are going to go through this systematically.
Ok, now that we have that in our file we still have to do three more things: register the block, give it its in-game name, and create the file CamelOreBlockOre.java. Let us start with registering the block. We just have to add this basic line (not nearly as complicated as the previous line):
The next thing we have to do is make an in-game name for our block. To do this we just have to add this line:
This is also self-explanatory. The oreTitanium is the block and �Titanium Ore� is the in-game name. We add this in the same place as our block register, the load function. Now it is going to look like this:
That is all we have to do for our mod_CamelOre. Now the last thing that we have to do is make the file CamelOreBlockOre. For now, this file will not do much but you can make your block do special stuff by following my setting properties for your new block tutorial (Coming Soon!). All you have to do is make a new CamelOreBlockOre.java that looks like this:
All that is important about this is the material. To choose the right materials just go to my properties for blocks tutorial (Coming Soon!).
Now you have a block that does not generate, is not viewable in creative mode gui, does not smelt, and does not craft into anything. I would highly recommend reading my other tutorials, because I do not want to squeeze any more stuff in here because it is already 1500 words long. Nevertheless, here are some screenshots and my ending code to finish this tutorial off.
Final Code
CamelOreBlockOre.java
mod_CamelOre.java
Author
Methuselah96
Creating A New Item
Prerequisites
[goto=block]Creating A New Block[/goto]
Minecraft Version
1.1
Tutorial
In this tutorial I am going to teach you a new item with ModLoader.
I will presume that you have read my ModLoader blocks tutorial mainly for the purpose that adding blocks and items are basically the same just a few changed words which will be explained this tutorial.
We are going to start out with the code we left off with in our block tutorial:
We will add this item almost exactly the same way we did for our block by adding this line:
If the part of this statement means the same thing for blocks and items I will just say same and you can look at the block tutorial.
Next we have to add it�s in-game name (you don�t have to register items like you do blocks). It works the same way as with a block so explanations needed:
We add it right after our block AddName like this:
That�s all in our mod_CamelOre. Now we just have to make the file CamelOreItem. As I said in my block tutorial, this file won�t do much but you can make it do certain things by following my setting properties for your new item tutorial (Coming Soon!). Here it is:
Now you have an item that you can�t get and does not craft into anything. I would highly recommend reading my other tutorials. But here are some screenshots and my ending code to finish this tutorial off.
Final Code
mod_CamelOre.java
CamelOreItem.java
Author
Methuselah96
Generating Ores
Prerequisites
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
Minecraft Version
1.1
Tutorial
In this tutorial I am going to teach you how to make your ores generate. In this tutorial I assume you know how to make a new block and item. If you don�t know how to do this you can read my block and item tutorials: [goto=block]Creating A New Block[/goto] and [goto=item]Creating A New Item[/goto]. This is our starting mod_CamelOre:
What we are going to do is generate our titanium ore. This is the function we have to add to do this:
Ok, so let�s break this down. First I should make sure you know what a chunk is. A chunk is just any 16x16x128. The 128 is the height.
Final Code
Author
Methuselah96
Creating A New Toolset
Prerequisites
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
Minecraft Version
1.1
Tutorial
In this mod I will be showing you how to add a new tool (when I use the word tool in this tutorial it includes pickaxe, shovel, axe, hoe, and sword) set to Minecraft using ModLoader. This tutorial will be a little bit longer but I have to write it sometime. I assume you know how to make a block and an item. If you don�t know how to do this you can learn how from my tutorials here: [goto=block]Creating A New Block[/goto] and [goto=item]Creating A New Item[/goto].
This is the mod_CamelOre that we start out with that has a titanium ore and a titanium ingot:
The first thing you need you need to do is make five new items like this:
Now there are really only two things I have to explain in this if you have followed my item tutorial. The first is that we have to make six separate files each called CamelOreItem*.java which will match up with the new CamelOreItem* in each statement. The second is that we have to make CamelOreEnumToolMaterial.java too. Our mod_CamelOre now looks like this:
We have to do two other things to our mod_CamelOre which I am not going to explain. We have to add names for our tools and make recipes for them. If you don�t know how to do those things you can learn how in my block and crafting recipe tutorials respectively: [goto=block]Creating A New Block[/goto] and [goto=crafting]Adding A Recipe[/goto]. Here it is:
Now we just have seven files left! Let�s start with CamelOreEnumToolMaterial. Here it is:
There are really only three (six) things you have to pay attention to in this file.
Now we have six left. But its not that bad. What we have to do is copy each original file and just change all the Item* to CamelOreItem* and all the EnumToolMaterial to CamelOreEnumToolMaterial We�re just going to look at one of them and then I�ll just give you the other five because you will know what they all mean. Here is CamelOreItemAxe:
The only thing you have to change in this file is CamelOreEnumToolMaterial to whatever your file is called. Then if you�re copying it to other files you just have to change the CamelOreItemAxe and CamelOreItemTool to CamelOreItemHoe, CamelOreItemPickaxe, CamelOreItemSpade, or CamelOreItemSword. Here are the other files to wrap up this tutorial:
CamelOreItemHoe:
CamelOreItemPickaxe:
CamelOreItemSpade:
CamelOreItemSword:
CamelOreItemTool:
Final Code
mod_CamelOre.java
CamelOreEnumToolMaterial
CamelOreItemAxe
CamelOreItemHoe
CamelOreItemPickaxe
CamelOreItemSpade
CamelOreItemSword
CamelOreItemTool
Author
Methuselah96
Adding A New Set Of Armor
Prerequisites
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
Minecraft Version
1.1
Tutorial
In this tutorial I am going to teach you how to make a new set of armor. I assume you already know how to make a new block and item. If you don�t you can read those tutorials here: [goto=block]Creating A New Block[/goto] and [goto=item]Creating A New Item[/goto].
This is the mod_CamelOre that we start out with that has a titanium ore and a titanium ingot:
The first thing you need you need to do is make four new items like this:
Now there are really only three things I have to explain in this if you have followed my item tutorial. The first is that we have to make a file called CamelOreItemArmor.java which will match up with the new CamelOreItemArmor in each statement. The second is that we have to make CamelOreArmorToolMaterial.java, too. The last is that ModLoader.AddArmor(�titanium�) means that you will need to make two new texture files in minecraft.jar/armor/ called titanium_1.png and titanium_2.png. These texture files are what the armor looks like when it�s being worn by a player and it should have the same format as the other armor texture files. So basically whatever �titanium� is, is what the name of the image file will be. It will always automatically be located in minecraft.jar/armor. Our mod_CamelOre now looks like this:
We have to do two other things to our mod_CamelOre which I am not going to explain. We have to add names for our tools and make recipes for them. If you don�t know how to do those things you can learn how in my block and crafting recipe tutorials respectively: . Here it is:
Now we just have two files left! Let�s start with CamelOreEnumArmorMaterial. Here it is:
There are really only three (six) things you have to pay attention to in this file.
Now we only have one left. Here is CamelOreItemArmor:
Final Code
mod_CamelOre.java
CamelOreItemArmor.java:
Author
Methuselah96
Adding A Recipe
Prerequisites
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
Minecraft Version
1.1
Tutorial
In this tutorial I am going to teach you how to make a new crafting recipe with ModLoader. I assume you know how to make a new block and item. If you don�t you can read how to here: [goto=block]Creating A New Block[/goto and [goto=item]Creating A New Item[/goto].
There is two different kinds of recipes you can add: regular recipes and shapeless recipes. I am going to start with regular recipes.
As an example I�m going to show you how to craft minecart tracks, but with titanium instead of iron. Here is the mod_CamelOre that we are starting with:
This is what we are going to be adding:
Now to break it down.
Now that we�re done doing a regular recipe it�s time for a shapeless recipe. First I should explain what a shapeless recipe is. Shapeless recipes are recipes that have two or more ingredients where those two ingredients can be placed wherever they want in the crafting grid to get a result. The most basic example are dyes. You can place two dyes wherever you want to get a new dye (in most cases). All of the rules are the same except there is no pattern. I�m going to do a really pointless one just for example and then this tutorial will be over:
There you go. I don�t think you really need an explanation for that besides that there is no recipe pattern. Here is our final mod_CamelOre:
Final Code
mod_CamelOre.java
Author
Methuselah96
Adding A Smelting Recipe
Prerequisites
[goto=block]Creating A New Block[/goto]
[goto=item]Creating A New Item[/goto]
Minecraft Version
1.1
Tutorial
In this tutorial I am going to teach you how to make a furnace recipe. I assume you know how to make a basic block and item. If you don�t you can read my tutorial here: [goto=block]Creating A New Block[/goto] and [goto=item]Creating A New Item[/goto].
Here is the mod_CamelOre that we are starting with:
This is the basic line that we are going to add that smelt a titanium ore in to a titanium ingot:
oreTitanium.blockID is the ingredient for the furnace recipe. If you were doing an item you would use .shiftedIndex instead of .blockID. If it is a non-modded block/item then you would put Block.dirt.blockID or Item.dye.shiftedIndex, but with modded blocks/items you just omit that prefix of Block./Item.. It is impossible to make the ingredient have a damage value without editing base classes. ingotTitanium is the result of the smelting. You use it the same way except you omit the suffix of .blockID/.shiftedIndex. Your final mod_CamelOre will look like this:
Final Code
mod_CamelOre.java
Author
Methuselah96
As in like options menu gui or furnace/crafting gui?
Use this for now: http://wiki.zidmc.info/index.php/Creating_A_GUI
If you have any questions just ask here.
The pieces would be:
*Transportation to another dimension (portals)
*Basic terrain generation (a modified version of the generating ores tutorial I believe)
*Registering mob spawns to the dimension
Currently working on random projects. Have any coding problems? Feel free to PM!
I will make it as soon as I can.
Like, how do you create it?
do you want this new dimension to be multi-biome or just like one biome?
what are you talking about?
Biomes would be a good thing to incorporate as well. The more comprehensive a tutorial the better imo. Probably could make a separate tutorial on how to make a biome and list it as a prerequisite. Sorry I'm piling this all on, I would help if I had the ability to...
Currently working on random projects. Have any coding problems? Feel free to PM!
for some reason the post got deleted
my apologies
"super(i, EnumArmorMaterial.CLOTH, j, k);" (In somethingItemArmor)
is the same as writing :
"public static final Item ArmorSomething= (new ItemArmor(3000, EnumArmorMaterial.CLOTH, ModLoader.AddArmor("Something"), 1)).setItemName("Something");"
Just saying, besides thet grate tut's thx for all of them man
after the titaniumore.png") you should add one more bracket other wise it wont let you use the functions cause its not declered object from what i understand (that was the way i fixed the eror in my script maybe i dont understand something and i done it wrong but i am pretty sure you forgote to close the bracket
thank you
Could you please revise your code on this tutorial, fix it if needed, and make it simpler where possible, since your tutorials are all on one page, easy to find, and have everything I need...
(Seriously, I've tried almost all of your tutorials, from blocks to items to armour, and then I go to an older modloader tutorial for armor, and it doesn't shoot up any errors)
i think i fixed all of them
if i missed any let me know
should be fixed now
Soaring in Hoenn