Basic Item-1.9

From McJty Modding
Jump to: navigation, search

In this chapter we show how to make a very basic first item:

public class FirstItem extends Item {

    public FirstItem() {
        setRegistryName("firstitem");        // The unique name (within your mod) that identifies this item
        setUnlocalizedName(ModTut.MODID + ".firstitem");     // Used for localization (en_US.lang)
        GameRegistry.register(this);
    }

}

Then it is recommended you have some centralized place where you initialize all your items. It is common to call this ModItems. The static init in this class should be called from within CommonProxy.preInit:

public class ModItems {

    public static FirstItem firstItem;

    public static void init() {
        firstItem = new FirstItem();
    }
}