Wiki 9Minecraft Just Enough Items Wiki
Just Enough Items WikiDocumentation › Runtime Jei Integration %5Bminecraft 1.21.11 To 26.2%5D

Runtime Jei Integration %5Bminecraft 1.21.11 To 26.2%5D

Note

Version note: This page covers Minecraft 1.21.11, 26.1.2, and 26.2.

Related pages for other README-supported versions:

  • Minecraft 1.21 and 1.21.1: Getting Started, Ingredients and Visibility, Recipes Overview
  • Minecraft 1.18.2, 1.19.2, and 1.20.1: Adding/Hiding Items, Recipes Overview
  • Minecraft 1.16.5: Adding/Hiding Items, Recipes Overview
  • Minecraft 1.12.2: Adding Items, Hiding Ingredients, Recipes Overview

Runtime JEI Integration

Most JEI work should happen in registration methods. Use runtime integration when information changes after JEI has finished loading, such as server-defined recipes, progression locks, or UI buttons that open JEI.

Store IJeiRuntime when it is available and clear it when it becomes unavailable.

public final class ExampleJeiPlugin implements IModPlugin {
  private static IJeiRuntime runtime;

  @Override
  public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
    runtime = jeiRuntime;
  }

  @Override
  public void onRuntimeUnavailable() {
    runtime = null;
  }
}

Always handle runtime == null. JEI can unload and reload during client lifecycle changes.

Opening JEI

Use IRecipesGui to show whole categories, focused lookups, or specific recipe lists.

public static void showCrusherRecipes() {
  if (runtime == null) {
    return;
  }

  runtime.getRecipesGui().showTypes(List.of(ExampleJeiPlugin.CRUSHING));
}

To focus on an ingredient, create an IFocus with IJeiHelpers#getFocusFactory.

ItemStack output = new ItemStack(ModItems.CRUSHED_ORE);
IFocus<ItemStack> focus = runtime.getJeiHelpers()
  .getFocusFactory()
  .createFocus(RecipeIngredientRole.OUTPUT, VanillaTypes.ITEM_STACK, output);

runtime.getRecipesGui().show(focus);

Runtime Recipes

If recipes become available after JEI registration, add them through the recipe manager.

runtime.getRecipeManager()
  .addRecipes(ExampleJeiPlugin.CRUSHING, serverCrusherRecipes);

For progression or server rules, hide and unhide recipes instead of removing and re-adding everything.

runtime.getRecipeManager()
  .hideRecipes(ExampleJeiPlugin.CRUSHING, lockedRecipes);

runtime.getRecipeManager()
  .unhideRecipes(ExampleJeiPlugin.CRUSHING, unlockedRecipes);

You can also hide or unhide a whole category with hideRecipeCategory and unhideRecipeCategory.

Runtime Ingredients

Use IIngredientManager when ingredients are created or removed while the game is running.

runtime.getIngredientManager()
  .addIngredientsAtRuntime(VanillaTypes.ITEM_STACK, generatedStacks);

runtime.getIngredientManager()
  .removeIngredientsAtRuntime(VanillaTypes.ITEM_STACK, removedStacks);

Use this for real runtime changes. If the ingredient list is known during startup, prefer registerExtraIngredients.

Search Filter

Mods can read or set JEI's current ingredient filter.

String previousFilter = runtime.getIngredientFilter().getFilterText();
runtime.getIngredientFilter().setFilterText("@examplemod");

Set the filter only in direct response to player action. Avoid changing a player's search text automatically during normal gameplay.

Advanced Registration

registerAdvanced is for uncommon integrations such as recipe manager plugins, category decorators, recipe buttons, or disabling JEI features that conflict with large vanilla behavior changes.

Prefer normal registration hooks first:

  • registerRecipes for recipes and info pages.
  • registerRecipeCatalysts for crafting stations.
  • registerGuiHandlers for screen integration.
  • registerRecipeTransferHandlers for transfer support.
  • Runtime APIs for data that actually changes after JEI loads.