1. Simple Item



Create Modid
Open your generated ExampleMod class file
and create a new String variable for our modid.

Is this a must?
No.

But it will help you out many times.
When you want to type your modid anywhere, you just have to call this string (like this ExampleMod.MODID)
and you can not mistype your modid. Another good thing about this is if you want to change your modid to something else, you just have to change it in your main class.

So create a new:
public static final String MODID = "examplemod";
above your constructor, just under your LOGGER;

After that change this line : @Mod("examplemod")
to this: @Mod(ExampleMod.MODID)

This will be the first example where you use your new MODID String variable.


After that we will create our new item.
For let's create a new package called: setup (to be more organized)
and a new class in the package and name it as: Registrations

In this new class we will create the list for our items.

private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ExampleMod.MODID);

Now we need to register this list
We will do that in a new method named as init() just under your ITEMS

public static void init() {
ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
}



Last step in this file will be the item registration.
Under the init method create this:

public static final RegistryObject<Item> SAPPHIRE = ITEMS.register("sapphire", ()-> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));

The registered name for our example item will be sapphire and the item will be in the Misc. tab when you are in creative mode.

Import everything!
Shortcut for import all is: CTRL + SHIFT + O
If you import the item, be sure to choose the item class of minecraft.
Now your code will look like this in your Registrations class.



We will now finish our main class too!
Go back to your ExampleMod class and in the ExampleMod constructor type:

Registrations.init();

We just called our init() method in our ExampleMod class to run the registration of our item list.


We still need a model, a texture and the language file for our item.
We need to make new folders for these.
You have to create them in your .../src/main/resources folder.
The most important thing is that you have to use the name just like how minecraft wants it.
You can't mistype them

In your resources create 3 new folder:
- lang
- models
- textures

In your models folder create a new folder and name it as item:
- item
These are the folders you can't mistype.
In the textures folder you can name your folders as you want.
We will create a new folder here named as items and put our item texture in there:
- items

In your lang folder create a new json file and name it as:
- en_us.json

Open your en_us.json file and type:
{
"item.examplemod.sapphire":"Sapphire"
}

The curly brackets are needed.
In the first quotes is the registered name of your item.
In the second quotes is the translated name of your item.

The only thing left is the Items json model file.
Create a new json file in your ../models/item/ folder
and name it as the registered name, so in my case it would be sapphire.json
now open it and type:
{
"parent": "item/generated",
"textures": {
"layer0":"examplemod:items/sapphire"
}
}

The parent is the generated.json file (try out "item/generated")
The texture can have more layer.
After layer0 you see the path to our texture
examplemod is the modid and as you can remember we created an items folder so thats why we typed "items/sapphire"




Now all that is left is to run the game and search your new Sapphire item.


I hope that this tutorial helped you to understand more about creating items.

Next time we will create tooltips (hover text) for a new item

If you found any errors in this tutorial then please comment on my youtube video or just about what you would love to see in a new example!

Have a nice day