diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d3238e56a..fca68aeb6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -39,7 +39,7 @@ nightConfig = "3.6.7" emi = "1.0.30+1.20.4" fabricPermissions = "0.3.20230723" iris = "1.6.14+1.20.4" -jei = "16.0.0.28" +jei = "17.3.0.48" modmenu = "9.0.0" moreRed = "4.0.0.4" oculus = "1.2.5" @@ -104,9 +104,9 @@ fabric-junit = { module = "net.fabricmc:fabric-loader-junit", version.ref = "fab fabricPermissions = { module = "me.lucko:fabric-permissions-api", version.ref = "fabricPermissions" } emi = { module = "dev.emi:emi-xplat-mojmap", version.ref = "emi" } iris = { module = "maven.modrinth:iris", version.ref = "iris" } -jei-api = { module = "mezz.jei:jei-1.20.2-common-api", version.ref = "jei" } -jei-fabric = { module = "mezz.jei:jei-1.20.2-fabric", version.ref = "jei" } -jei-forge = { module = "mezz.jei:jei-1.20.2-forge", version.ref = "jei" } +jei-api = { module = "mezz.jei:jei-1.20.4-common-api", version.ref = "jei" } +jei-fabric = { module = "mezz.jei:jei-1.20.4-fabric", version.ref = "jei" } +jei-forge = { module = "mezz.jei:jei-1.20.4-forge", version.ref = "jei" } mixin = { module = "org.spongepowered:mixin", version.ref = "mixin" } modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" } moreRed = { module = "commoble.morered:morered-1.20.1", version.ref = "moreRed" } @@ -175,7 +175,7 @@ externalMods-common = ["jei-api", "nightConfig-core", "nightConfig-toml"] externalMods-forge-compile = ["moreRed", "oculus", "jei-api"] externalMods-forge-runtime = [] externalMods-fabric-compile = ["fabricPermissions", "iris", "jei-api", "rei-api", "rei-builtin"] -externalMods-fabric-runtime = [] +externalMods-fabric-runtime = ["jei-fabric", "modmenu"] # Testing test = ["junit-jupiter-api", "junit-jupiter-params", "hamcrest", "jqwik-api"] diff --git a/projects/common/src/main/java/dan200/computercraft/shared/integration/jei/RecipeResolver.java b/projects/common/src/main/java/dan200/computercraft/shared/integration/jei/RecipeResolver.java index afccd5a5e..d07c57266 100644 --- a/projects/common/src/main/java/dan200/computercraft/shared/integration/jei/RecipeResolver.java +++ b/projects/common/src/main/java/dan200/computercraft/shared/integration/jei/RecipeResolver.java @@ -4,6 +4,7 @@ package dan200.computercraft.shared.integration.jei; +import dan200.computercraft.api.ComputerCraftAPI; import dan200.computercraft.shared.integration.UpgradeRecipeGenerator; import dan200.computercraft.shared.pocket.items.PocketComputerItem; import dan200.computercraft.shared.turtle.items.TurtleItem; @@ -12,13 +13,16 @@ import mezz.jei.api.recipe.IFocus; import mezz.jei.api.recipe.RecipeType; import mezz.jei.api.recipe.advanced.IRecipeManagerPlugin; import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.RecipeHolder; import java.util.List; class RecipeResolver implements IRecipeManagerPlugin { - private final UpgradeRecipeGenerator resolver = new UpgradeRecipeGenerator<>(x -> x); + private static final ResourceLocation RECIPE_ID = new ResourceLocation(ComputerCraftAPI.MOD_ID, "upgrade"); + private final UpgradeRecipeGenerator> resolver = new UpgradeRecipeGenerator<>(x -> new RecipeHolder<>(RECIPE_ID, x)); @Override public List> getRecipeTypes(IFocus focus) { @@ -44,8 +48,8 @@ class RecipeResolver implements IRecipeManagerPlugin { } return switch (focus.getRole()) { - case INPUT -> cast(resolver.findRecipesWithInput(stack)); - case OUTPUT -> cast(resolver.findRecipesWithOutput(stack)); + case INPUT -> cast(RecipeTypes.CRAFTING, resolver.findRecipesWithInput(stack)); + case OUTPUT -> cast(RecipeTypes.CRAFTING, resolver.findRecipesWithOutput(stack)); default -> List.of(); }; } @@ -56,7 +60,7 @@ class RecipeResolver implements IRecipeManagerPlugin { } @SuppressWarnings({ "unchecked", "rawtypes" }) - private static List cast(List from) { + private static List cast(RecipeType ignoredType, List from) { return (List) from; } }