Skip to content

Getting Started [JEI 10 or higher for Forge or Fabric]

James Mitchell edited this page Sep 8, 2024 · 7 revisions

Set up your Gradle build script

You can integrate and automatically download JEI for your mod project using Gradle.
Just add the following to your build script (build.gradle):

Repositories

repositories {
  maven {
    // location of the maven that hosts JEI files before January 2023
    name = "Progwml6's maven"
    url = "https://dvs1.progwml6.com/files/maven/"
  }
  maven {
    // location of the maven that hosts JEI files since January 2023
    name = "Jared's maven"
    url = "https://maven.blamejared.com/"
  }
  maven {
    // location of a maven mirror for JEI files, as a fallback
    name = "ModMaven"
    url = "https://modmaven.dev"
  }
}

Dependencies for ForgeGradle

dependencies {
  /* other minecraft dependencies are here */

  // compile against the JEI API but do not include it at runtime
  compileOnly(fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}"))
  // at runtime, use the full JEI jar for Forge
  runtimeOnly(fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}"))
}

Dependencies for Fabric Loom

dependencies {
  /* other minecraft dependencies are here */

  // compile against the JEI API but do not include it at runtime
  modCompileOnlyApi("mezz.jei:jei-${mc_version}-fabric-api:${jei_version}")
  // at runtime, use the full JEI jar for Fabric
  modRuntimeOnly("mezz.jei:jei-${mc_version}-fabric:${jei_version}")
}

Choose a Version

${mc_version} gets replaced by the current Minecraft version. (i.e. 1.19)
${jei_version} gets replaced by the version of JEI you want to use (i.e 11.0.0.206)

For a list of available JEI versions, see CurseForge or the maven listing.

These properties can be set in a file named gradle.properties, placed in the same directory as your build.gradle file.

For this example, your gradle.properties would look like this:

mc_version=1.19
jei_version=11.0.0.206

Why compile against the API?

The example script only compiles against the API, which is very stable. When you run your mod (runtime), the full JEI will run as well so that you can still test with it in development.

If you make the mistake of compiling against the full mod jar and then use classes from JEI that are not in the API, your mod could break any time JEI updates.

If you find that you need a feature that is not in the API, be sure to ask on the issue tracker.

Clone this wiki locally