Skip to content

Commit

Permalink
Update JEI to 10.0 in dev, fix a bug caused by JEI breaking their API
Browse files Browse the repository at this point in the history
See SlimeKnights/TinkersConstruct#5147 for the impact
I get that they bumped their API to 10.0, but they kept all the other 9.0 API features around, just not recipe.getSize.
Looks like getWidth and getHeight both exist on both APIs so I can use them and declare compat with both for now
  • Loading branch information
KnightMiner committed Feb 13, 2024
1 parent 5ffb9df commit 44c097e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
10 changes: 8 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ repositories {
name 'DVS1 Maven FS'
url 'https://dvs1.progwml6.com/files/maven'
}
maven {
// JEI
name = "Jared's maven"
url = "https://maven.blamejared.com/"
}
maven {
// for Yarn2MCP
name "yarn2mcp"
Expand Down Expand Up @@ -170,9 +175,10 @@ dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"

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

def modsTomlSpec = copySpec{
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ forge_range=[40.1.9,)
parchment_version=2022.03.13

# Build dependencies
jei_version=9.5.3.153
jei_version=10.+
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package slimeknights.mantle.plugin.jei;

import com.google.common.collect.ImmutableList;
import lombok.Getter;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.ingredient.IGuiIngredientGroup;
Expand Down Expand Up @@ -33,7 +34,8 @@
public class RetexturableRecipeExtension implements ICraftingCategoryExtension, ICustomCraftingCategoryExtension, ITooltipCallback<ItemStack> {
/** Actual recipe instance */
private final ShapedRetexturedRecipe recipe;
/** Recipe size */
/** Recipe size, TODO: remove when fully updating to JEI 10.0/11.0 */
@Getter
private final Size2i size;
/** List of all possible outputs, for the sake of recipe lookups */
private final List<List<ItemStack>> allOutputs;
Expand Down Expand Up @@ -76,8 +78,13 @@ public void setIngredients(IIngredients ingredients) {
}

@Override
public Size2i getSize() {
return size;
public int getWidth() {
return recipe.getRecipeWidth();
}

@Override
public int getHeight() {
return recipe.getRecipeHeight();
}

@Override
Expand Down

0 comments on commit 44c097e

Please sign in to comment.