This part hasn't changed over the versions of Minecraft a whole lot, although there have been some mutations in the exact method signatures as well as class hierarchy. A basic item (one that has no functionality, such as a stick or ingot: that's right, both are do-nothing items!)
public class CustomItem extends Item {
public CustomItem () {
super();
this.setMaxDamage(0);
this.setCreativeTab(CreativeTabs.MISC);
}
}
Not much room for customization at this point, unlike blocks. About all we can do is change whether or not the item can take damage (tools use this) and what creative tab it will exist in. Name and texture we'll handle when we register the item with the GameRegistry.
However, this is all that is needed in order to hold, carry, drop, craft, smelt and otherwise utilize the item. Some items in Minecraft (such as sticks) don't even have a unique class and simply use new Item()
. We could do that here, however any item with additional functionality will need a class.