Home > Articles > Certification > Microsoft Certification

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

Workshop

You now know the basics of items. In the next few hours, you will learn more about them. Therefore, it’s important to fully understand the basics. To do that, you might want to work through this workshop.

Quiz

  1. What would the best unlocalized name be for an item variable called alarmClock?
  2. What is wrong with the following code?

    public static Item key ;
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
        GameRegistry.registerItem(key, “Key”);
        key = new ItemKey();
    }

Answers

  1. The best unlocalized name is alarmClock, because it’s generally smartest to use the variable name.
  2. The item is registered before initializing it to something. This will crash your mod. Always make sure the registerItem method is below the Item init line.
  • + Share This
  • 🔖 Save To Your Account