First, let’s add a language resource so that we can give it a name that looks reasonable.
To do this, in the folder src/main/resources add a new package. I called it assets.modderdojo.lang: you can change “modderdojo” but the other parts have to stay the same.
In the package, add a new file called “en_US.lang” which indicates that it is for Minecraft when the language is set to English – US. The file has one line which tells us what English name to use for the item with the unlocalised name MichaelFirstItem:
item.MichaelFirstItem.name=Michael's ModderDojo Coin
Now let’s add a texture.
Using a painting package (for example Microsoft Paint or Paint.NET), create 16×16 pattern. Give it a transparent background. Then save it in PNG format.
In the src/main/resources folder, create a new package called assets.modderdojo.textures.items (you can change modderdojo to something else, but the rest has to stay the same). Put the PNG file in it. In my case, the file is called md2.png:
In your mod class preInit method, add one more line:
first.setTextureName("modderdojo:md2");
The name you set is based on where you put it “assets.modderdojo.textures.items” followed by a colon “:” followed by the name of the PNG file put without “.png”: md2.png.
Now when you run the code, your mod should have its correct name and appearance.