Now that you know how food works in Minecraft, it is time to create your own food item. To do this, you add a new item to the mod file.
First, add the basic item code to the file, which is as follows in the mod file:
public static Item berry;
Then, add the following to the
berry = new ItemBerry();GameRegistry.registerItem(berry, "Berry");
With this code, you have an error under
ItemBerry. That is because you haven’t yet created that class.
To create the
ItemBerry class, hover your mouse over the error and click Create Class. You will get a file that looks like Listing 6.1.