[Tutorial] Adding JEI descriptions to items from your mod

Started by cubicgraphics on Sun, 04/11/2021 - 20:49

Topic category: User side tutorials

Last seen on 17:47, 5. May 2021
Joined May 2017

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
[Tutorial] Adding JEI descriptions to items from your mod
Sun, 04/11/2021 - 20:52 (edited)

First you need to have the jei api,
To add this to mcreator open your build.gradle file

After Opening it you need to add

repositories {
  maven {
    // location of the maven that hosts JEI files
    name = "Progwml6 maven"
    url = "https://dvs1.progwml6.com/files/maven/"
  maven {
    // location of a maven mirror for JEI files, as a fallback
    name = "ModMaven"
    url = "https://modmaven.k-4u.nl"

into the file


 compileOnly fg.deobf("mezz.jei:jei-1.15.2:")
  // at runtime, use the full JEI jar
  runtimeOnly fg.deobf("mezz.jei:jei-1.15.2:")

inside the bit at the bottom that says dependencies

So it looks like that.

Now to add descriptions to items
Create a new custom element and name it JeiPlugin or something along those lines.
Open it and delete everything except for the package line so it looks like this:

My mod is called dronecraft, your mods name should be where that word is.

Next add this code to your file:

import mezz.jei.api.*;
import mezz.jei.api.ingredients.IIngredientType;
import mezz.jei.api.recipe.category.IRecipeCategory;
import mezz.jei.api.registration.IRecipeRegistration;
import mezz.jei.api.runtime.*;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import java.util.*;
import java.util.stream.Collectors;
import net.minecraft.util.registry.Registry;
import net.minecraftforge.server.command.ModIdArgument;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;

public class [custom element name] implements IModPlugin { 
	public ResourceLocation getPluginUid() {
		return new ResourceLocation("[mod name]", "default");

        public void registerRecipes(IRecipeRegistration registry) {
		IIngredientManager ingredientManager = registry.getIngredientManager();

		IIngredientType<ItemStack> itemType = ingredientManager.getIngredientType(ItemStack.class);


So it should look like this:

In the screenshot I have replaced the [custom element name] and [mod name] with the custom element name and the mods name.

If it has been done correctly so far, it should not come up with any errors when you click on the build mod button or press play.

To add a description to an item then add this code below the IIngredientType line

registry.addIngredientInfo(new ItemStack([itemname].block), itemType, "[description]");

And also import the item or block you are creating the description for

import net.mcreator.[modname].item.[ItemName];

import net.mcreator.[modname].block.[BlockName];


And they should appear in game

If you are having trouble trying to get the names of your items then i have a solution
Make a procedure and do this

(I have put in the item and block from my example)

Then close and save it, then open it using the edit code button.

You can get the names of the items / blocks here and delete the procedure after you have finished.
I hope this easy enough to follow or that I have explained it well enough.

Edited by cubicgraphics on Sun, 04/11/2021 - 20:52
Last seen on 14:09, 6. May 2021
Joined May 2020

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Nice tutorial! One question…
Tue, 04/20/2021 - 11:31

Nice tutorial!

One question tough: if I want to have several items having a description, do I need to create the custom element JeiPlugin for each one or can i put all the descriptions in the same one? And if yes, how?

Thanks in advance