Minecraft 1.14 modding with forge – 4 – Custom basic item

Hello everyone,

Today I am going to show how to make a custom item, I am going to show you how to register your items and what assets you need to add.

Items are registered in the RegistryEvent.Register<Item> event (This event is fired on the MOD bus!).

  • In the registerItems method, you can register the item by calling event.registerAll and passing in a new instance of the Item class.
    To create an instance of the Item class you need to pass in a Item.Properties instance. You can call methods on this instance to set things like the items creative tab, stacksize and maxDamage.
  • You also need to set the registryname on for your item, you do this by calling setRegistryName on the item instance and passing in your modid for the first argument, and the item name as the second argument, the name has to be all lowercase and can only contain the following characters: a-z 0-9 / . _
  • You may want to access the item instance later again, this is possible! Add the @ObjectHolder annotation above the class and pass in your modid. Now create a public static final Item variable, the name has to exactly match your item’s registry name (Because it is final you need to set it to null, but forge will set it to your item’s instance).

This is technically enough for forge to load the item. When you start the game, and load a world you can give yourself the item with the command: “/give @p modid:itemname”. When you do this you will see that it doesn’t have a model and texture yet. So lets add those right now!

To add a model and texture create a some new folders in src/main/resources called assets/modid. In this folder create models/item  and textures/item.

In textures/item you can add a texture (make sure its size is a power of 2, 16×16, 32×32, etc.). It doesn’t matter what you call it but it has to be lowercase and you have to remember the name. I will call it tutorial_dust.png and I will use this texture:
In the models/item package create a new json file. In the json file add the following json code:

Remember to save it as REGISTRYNAME.json. You have to replace the words in capslock with the corresponding values, REGISTRYNAME should be the same as the item’s registry name. The texture name shouldn’t contain the extension (.png).

You may have noticed that the name isn’t displaying correct. That is because we haven’t added a lang file yet, so lets do that. In assets/modid create a new folder called lang, in this folder create a new json file. In this json file add the following json:

And again, replace the words in caps with your own values. Save this file in the lang package and call it en_us.json.

Now you can start the game and you should have an item with texture and name!

displays the item in an item frame

This would be an example on how to make it stack to max 32 and add it to a creative tab (ItemGroup):

new Item(new Item.Properties().maxStackSize(32).group(ItemGroup.MISC)).setRegistryName(Reference.MODID, "tutorial_dust")

Well, that was it for this part! In the next part, we will add a custom block. By clicking here you will be sent to the code of this tutorial.
As always if you have any question don’t hesitate to ask in the comments! Also if you saw any errors in the tutorial please let me know so I can fix it!


Posted in Forge tutorial, Forge Tutorial 1.14.

Leave a Reply

Your email address will not be published. Required fields are marked *