top of page

Basic Item 

Welcome to my basic item tutorial! In this tutorial we will create a basic item. We're creating a Lead Ingot for our Lead Ore that we created last tutorial. Okay so lets dive straight into it! First Lets create the Init Items class in the newly create items package just like the blocks. Its almost exactly the same as the Blocks Init class. Make a new class called "InitItems" and a public static void method named init. Next we make the Item Variable. It is exactly like the block except we use - you guessed it - the Item Class. Then in the init method we assign our ingot to its class. 

Now on to the Ingot class. Oh! Good job if you figured out what we forgot to do. We need to add the item Constants! On the lines below in the Constants file make two new constants named INGOT_LEAD_NAME and INGOT_LEAD_TEXTURE. The name will be "ingot_lead" and the texture the same. Okay now back into the item class. Create the constuctor, heres a shortcut, press ctrl+space to bring up a list of avaliable methods. Click the constructor. In the constructor we are going to have 4 methods to use. Exactly the same as the Blocks, set the creative tab to be materials instead. To register the name, the method is "setUnlocalizedName" and the exact same as the block but of course INGOT_LEAD_NAME instead. The textures is "setTextureName" and again the same. Lastly, we register the item with GameRegisty.registerItem(this, Constants.INGOT_LEAD_NAME); Now to add localization and textures and we're done!

Now with localizations. Open the en_US file in the assets lang folder. To do items, its easy. Do "item." then mod_id+unlocalizedName+".name". Make it equal the correct localization just like this: item.forgemc_ingot_lead.name=Lead Ingot 

 

Cool! Our Localizations should be working. Now for the textures. Go to the location where the "blocks" folder that contained the textures for our blocks. Make a new folder within the "textures" folder (where the blocks folder is) called "items" Note: No other name will work just like with the blocks. Put the texture in there and boom! The texture should work. Now all thats left is to add the InitItems into the Init method just like we did with the block in the mod file and we're done! Next tutorial will be Ore Dictionary, Crafting Recipes and Smelting, Hope to see you there! 

 

 

 

bottom of page