mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-11-10 20:09:58 +00:00
Fix incorrect cast for JEI
This commit is contained in:
parent
fc834cd97f
commit
9c202bd1c2
@ -39,7 +39,7 @@ nightConfig = "3.6.7"
|
|||||||
emi = "1.0.30+1.20.4"
|
emi = "1.0.30+1.20.4"
|
||||||
fabricPermissions = "0.3.20230723"
|
fabricPermissions = "0.3.20230723"
|
||||||
iris = "1.6.14+1.20.4"
|
iris = "1.6.14+1.20.4"
|
||||||
jei = "16.0.0.28"
|
jei = "17.3.0.48"
|
||||||
modmenu = "9.0.0"
|
modmenu = "9.0.0"
|
||||||
moreRed = "4.0.0.4"
|
moreRed = "4.0.0.4"
|
||||||
oculus = "1.2.5"
|
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" }
|
fabricPermissions = { module = "me.lucko:fabric-permissions-api", version.ref = "fabricPermissions" }
|
||||||
emi = { module = "dev.emi:emi-xplat-mojmap", version.ref = "emi" }
|
emi = { module = "dev.emi:emi-xplat-mojmap", version.ref = "emi" }
|
||||||
iris = { module = "maven.modrinth:iris", version.ref = "iris" }
|
iris = { module = "maven.modrinth:iris", version.ref = "iris" }
|
||||||
jei-api = { module = "mezz.jei:jei-1.20.2-common-api", 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.2-fabric", version.ref = "jei" }
|
jei-fabric = { module = "mezz.jei:jei-1.20.4-fabric", version.ref = "jei" }
|
||||||
jei-forge = { module = "mezz.jei:jei-1.20.2-forge", version.ref = "jei" }
|
jei-forge = { module = "mezz.jei:jei-1.20.4-forge", version.ref = "jei" }
|
||||||
mixin = { module = "org.spongepowered:mixin", version.ref = "mixin" }
|
mixin = { module = "org.spongepowered:mixin", version.ref = "mixin" }
|
||||||
modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" }
|
modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" }
|
||||||
moreRed = { module = "commoble.morered:morered-1.20.1", version.ref = "moreRed" }
|
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-compile = ["moreRed", "oculus", "jei-api"]
|
||||||
externalMods-forge-runtime = []
|
externalMods-forge-runtime = []
|
||||||
externalMods-fabric-compile = ["fabricPermissions", "iris", "jei-api", "rei-api", "rei-builtin"]
|
externalMods-fabric-compile = ["fabricPermissions", "iris", "jei-api", "rei-api", "rei-builtin"]
|
||||||
externalMods-fabric-runtime = []
|
externalMods-fabric-runtime = ["jei-fabric", "modmenu"]
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
test = ["junit-jupiter-api", "junit-jupiter-params", "hamcrest", "jqwik-api"]
|
test = ["junit-jupiter-api", "junit-jupiter-params", "hamcrest", "jqwik-api"]
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
package dan200.computercraft.shared.integration.jei;
|
package dan200.computercraft.shared.integration.jei;
|
||||||
|
|
||||||
|
import dan200.computercraft.api.ComputerCraftAPI;
|
||||||
import dan200.computercraft.shared.integration.UpgradeRecipeGenerator;
|
import dan200.computercraft.shared.integration.UpgradeRecipeGenerator;
|
||||||
import dan200.computercraft.shared.pocket.items.PocketComputerItem;
|
import dan200.computercraft.shared.pocket.items.PocketComputerItem;
|
||||||
import dan200.computercraft.shared.turtle.items.TurtleItem;
|
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.RecipeType;
|
||||||
import mezz.jei.api.recipe.advanced.IRecipeManagerPlugin;
|
import mezz.jei.api.recipe.advanced.IRecipeManagerPlugin;
|
||||||
import mezz.jei.api.recipe.category.IRecipeCategory;
|
import mezz.jei.api.recipe.category.IRecipeCategory;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.crafting.CraftingRecipe;
|
import net.minecraft.world.item.crafting.CraftingRecipe;
|
||||||
|
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
class RecipeResolver implements IRecipeManagerPlugin {
|
class RecipeResolver implements IRecipeManagerPlugin {
|
||||||
private final UpgradeRecipeGenerator<CraftingRecipe> resolver = new UpgradeRecipeGenerator<>(x -> x);
|
private static final ResourceLocation RECIPE_ID = new ResourceLocation(ComputerCraftAPI.MOD_ID, "upgrade");
|
||||||
|
private final UpgradeRecipeGenerator<RecipeHolder<CraftingRecipe>> resolver = new UpgradeRecipeGenerator<>(x -> new RecipeHolder<>(RECIPE_ID, x));
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <V> List<RecipeType<?>> getRecipeTypes(IFocus<V> focus) {
|
public <V> List<RecipeType<?>> getRecipeTypes(IFocus<V> focus) {
|
||||||
@ -44,8 +48,8 @@ class RecipeResolver implements IRecipeManagerPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return switch (focus.getRole()) {
|
return switch (focus.getRole()) {
|
||||||
case INPUT -> cast(resolver.findRecipesWithInput(stack));
|
case INPUT -> cast(RecipeTypes.CRAFTING, resolver.findRecipesWithInput(stack));
|
||||||
case OUTPUT -> cast(resolver.findRecipesWithOutput(stack));
|
case OUTPUT -> cast(RecipeTypes.CRAFTING, resolver.findRecipesWithOutput(stack));
|
||||||
default -> List.of();
|
default -> List.of();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -56,7 +60,7 @@ class RecipeResolver implements IRecipeManagerPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
private static <T, U> List<T> cast(List<U> from) {
|
private static <T, U> List<T> cast(RecipeType<U> ignoredType, List<U> from) {
|
||||||
return (List) from;
|
return (List) from;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user