Modding TuT - Creating a new Item type

Thanks to this forum post!

Creating a new Item type

1. You need to create a new file called ItemExample.java in the src directory. 2. The basic structure of the file is this: package net.minecraft.src; public class ItemExample extends Item {    public ItemFood(int i)     { super(i); maxStackSize = 64; }    public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {    } }

3. You now need to add this item to minecraft so that it knows about it. To do this open up Item.java 4. Towards the bottom of the file there should be a whole heap of instance variables, add a new one: public static Item example = (new ItemExample(95)).setIconIndex(42);

This will create a new item which is item id 256 + 95 and uses icon 42. Therefore it should look like a sign. Currently it has no properties, and you cannot craft it. But after you compile and run the mod it will add the new item to minecraft.