[Java] [Java]Let’s create a Minecraft Mod 1.16.1 [Add Items]

2 minute read

(This article is one of a series of commentary articles)

Top article: Introduction Previous article: Basic File Next article: Add Block

Add item

First, we will add basic items. 1.14.4Ichangedthewayofwritingalittle(itdoesnotmeanthattheimplementationmethodchangedduetotheversionupgrade).

Item registration

   ├ item
   │ └ Items.java
   └ LiveInWater.java


package jp.koteko.liveinwater.item;

import jp.koteko.liveinwater.LiveInWater;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

import java.util.ArrayList;
import java.util.List;

@Mod.EventBusSubscriber(modid = LiveInWater.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class Items {
    public static List<Item> itemList = new ArrayList<Item>();
    public static final Item WATERTREE_ROOT = register("watertree_root", new Item((new Item.Properties()).group(ItemGroup.MATERIALS)));

    private static Item register(String key, Item itemIn) {
        return itemIn.setRegistryName(LiveInWater.MOD_ID, key);

    public static void registerItems(RegistryEvent.Register<Item> event) {
        for (Item item: itemList) {

At the same time as declaring and initializing, add items to List, and register() all items in the list in a for loop.

Each annotation has the following functions.


Annotate a class which will be subscribed to an Event Bus at mod construction time.Defaults to subscribing the current modid to the MinecraftForge.EVENT_BUS on both sides.

It seems that this class is registered in EventBus of forge.


Annotation to subscribe a method to an Event This annotation can only be applied to single parameter methods, where the single parameter is a subclass of Event.Use IEventBus.register(Object) to submit either an Object instance or a Class to the event bus For scanning to generate callback IEventListener wrappers.The Event Bus system generates an ASM wrapper that dispatches to the marked method.

It seems necessary to indicate that the method is a handler.

If you attach these, items will be automatically registered.

In the case of a simple non-functional item, it is simply an instance of the Item class. As the name suggests, Item.Properties is a class that manages the properties of items, and you can do various things besides group() that sets the creative tab. Also, for the instance of the Item class, use setRegistryName() to determine the internal name when registering the item in forge. Use MOD_ID for the namespace and use the format MOD_ID:ITEM_NAME.

resource settings

Item addition is completed in the previous section, but since it is not displayed in the game as it is, we will set these. Place the files under resources.

   └ assets
      └ liveinwater
         ├ lang
         │ └ en_us.json
         │ └ ja_jp.json
         ├ models
         │ └ item
         │ └ watertree_root.json
         └ textures
            └ item
               └ watertree_root.png

(The name is slightly changed from the article in 1.14.4.)

  "item.liveinwater.watertree_root": "WaterTree Root"
  "item.liveinwater.watertree_root": "Watertree root"

"item.[MOD_ID].[ITEM_NAME]": "Display name"


  "parent": "item/generated",
  "textures": {
    "layer0": "liveinwater:item/watertree_root"

For simple items, parent is item/generated MOD_ID:[texture file path]

textures\item\watertree_root.png The formula is like 16*16 png, so create a texture according to this and place it. (It’s very difficult to write by yourself…)


Launch the game and check. Capture.PNG Since ItemGroup.MATERIALS is specified, items are added to this tab in the case of a creative. The texture is reflected properly and the name set in the language file is displayed.


[Minecraft Forge Event System Overview-Minecraft Modding Wiki](https://mcmodding.jp/modding/index.php/Minecraft_Forge_Event%E3%82%B7%E3%82%B9%E3%83%86%E3%83%(A0%E6%A6%82%E8%A6%81) Create [Java]Minecraft Mod 1.14.4 [1. Add Items] Minecraft 1.14.4 Forge Mod Part 3 [Add non-functional items]

Next article

Add Block