Registering items is done from your main mod class, or a ModItems class method invoked from the main mod class during preInit.
Item item = new CustomItem();
string registryname = "my_item";
item.setRegistryName(registryname);
item.setUnlocalizedName(item.getRegistryName().toString());
GameRegistry.register(item);
There is an important reason to use item.setUnlocalizedName(item.getRegistryName().toString());
as well! It insures that your item's unlocalized name contain the mod ID to avoid language file conflicts between mods.
Now the item needs a model too, and this is where things got difficult post 1.7.10, which just involved telling Minecraft the name of the texture to load and could be specified in the item's constructor.
final ModelResourceLocation fullModelLocation = new ModelResourceLocation(item.getRegistryName().toString(), "inventory");
ModelBakery.registerItemVariants(item, fullModelLocation);
ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition()
{
public ModelResourceLocation getModelLocation(ItemStack stack)
{
return fullModelLocation;
}
});
Note that this section must be located client-side only (i.e. the client proxy) as many of the referenced classes do not exist on the dedicated server.
Registering items with variants e.g. Saplings, has to be done a different way, using ModelLoader.setCustomModelResourceLocation(item, metadata, resourceLocation)
although it lets us use a Blockstate file to specify our variants (which is much preferred to the alternative). Our item doesn't use variants, so we're done.