Home > Articles > Certification > Microsoft Certification

  • Print
  • + Share This
This chapter is from the book


Improve the item even more by passing the unlocalized name of the item through the constructor. Some things you will have to do for that:

  1. Add a String variable to the constructor.
  2. Add the unlocalized name in the mod file where you use the constructor, which should be the item init line.
  3. Remove the String variable in the ItemKey class because you don’t need it anymore.

The code in the mod file:

key = new ItemKey( “key” );

The constructor of ItemKey:

public ItemKey(String name)
        setUnlocalizedName(SamsMod.MODID + “_” + name);
        setTextureName(SamsMod.MODID + “:” + name);
  • + Share This
  • 🔖 Save To Your Account