Minecraft 1.13 modding with forge – 3 – Custom basic item

Hello everyone,

Today we are going to make a custom item, I am going to show you how to register your items, register item models, and work with RegistryEvents.

First, we need to create a class where we are going to register all of our items. (Technically you don’t need this, but I find it easier to work with if all of my items are registered separately from other things like blocks)

  1. Create another package inside the mod package and call it init. In this package, we will put all of our item, block etc. initialization classes.
  2. Inside the init package create a class ModItems.

The item we will be creating will be the most basic item possible, it won’t have any special effects.

In the ModItems class, we will be instantiating and registering our objects.

Now we need to let forge know we want to register an item, this is done in a RegistryEvent.
Add a public static method called registerItems it has to have an argument of type RegistryEvent.Register<Item> I’ll refer to this argument as event but a better more descriptive name could be itemRegistryEvent. Above the method add an annotation @SubscribeEvent and above the class declaration add an annotation @Mod.EventBusSubscriber and set the modid argument to your modid and the bus value to Bus.MOD (In pre 1.13 versions you didnt need to set the bus, but this changed in 1.13).

  • 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.
  • Now 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). It’s better to use ObjectHolder because people could possibly replace your item, and now you’ll automatically use that replacement.


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 new package in the src/main/resources folder called assets.modid and ofcourse replace modid with your modid. In this package, we have to create some more packages. Create: models.item and textures.item.
In the textures.item package 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 text file. In the text file add the following json code:

Remember to save it as NAME.json. You have to replace the words in capslock with the corresponding values, NAME 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 the assets.modid package create a new package called lang, in this package create a new text file. In this text file add the following line:

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!

It would probably be smart to add it to a creative tab, in the ModItems class’ init method you can change some simple things about the item. Because of the way minecraft is made you can chain method calls after eachother. Call the method group on the Item.Properties instance, I will put it in the miscellaneous creative tab. So I will pass the method ItemGroup.MISC. Just to show you how to chain methods I make it stack to 32. I will do this by calling maxStackSize. This is the line I have now:

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 send to the code of this part.
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!

~suppergerrie2

Posted in Forge tutorial, Forge Tutorial 1.13.

10 Comments

  1. Never mind once again. I am simply an idiot and thought the folder names needed dots in them. Please forgive me for cluttering your comment section.

    • Don’t worry! It is kind of confusing, IntelliJ calls them folders/directories and thus handles it that way (so / instead of .) while eclipse uses packages. The terminology I used here was for eclipse while all of the other parts of the tutorial are with IntelliJ terminology. Sorry about that!

  2. Hi! First off, I love these tutorials! They’re the easiest to follow that I’ve seen. However, I have encountered a problem. I am unable to progress beyond adding the item because IntelliJ won’t let me add packages to src/main/resources, only directories.

    • My apologies, I found a way to get around this by creating the folders directly in Windows Explorer. I think it might have to do with the periods in the names.

      • Sorry again, I have created the nessecary files through the Explorer, and they appear in IntelliJ, but when I run it, the item still has no model, texture, or corrected name.

  3. I’m a little confused – you say that the variable name has to match the registry name, and yet the variable is called “tutorial_item” while the registry name is set to “tutorial_dust.”

Leave a Reply

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