diff --git a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java index 785b233b7..fb7aedf05 100644 --- a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java +++ b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java @@ -31,6 +31,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.*; import net.minecraft.world.level.ItemLike; +import net.minecraftforge.common.crafting.IShapedRecipe; import net.minecraftforge.fml.ModList; import javax.annotation.Nonnull; @@ -94,7 +95,7 @@ public class CreateJEI implements IModPlugin { .build(), autoShapeless = register("automatic_shapeless", MixingCategory::autoShapeless) - .recipes(r -> r.getSerializer() == RecipeSerializer.SHAPELESS_RECIPE && r.getIngredients() + .recipes(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe) && r.getIngredients() .size() > 1 && !MechanicalPressTileEntity.canCompress(r) && !AllRecipeTypes.isManualRecipe(r), BasinRecipe::convertShapeless) .catalyst(AllBlocks.MECHANICAL_MIXER::get) @@ -173,11 +174,11 @@ public class CreateJEI implements IModPlugin { .build(), autoShaped = register("automatic_shaped", MechanicalCraftingCategory::new) - .recipes(r -> r.getSerializer() == RecipeSerializer.SHAPELESS_RECIPE && r.getIngredients() + .recipes(r -> r instanceof CraftingRecipe && !(r instanceof IShapedRecipe) && r.getIngredients() .size() == 1) .recipes(r -> (r.getType() == RecipeType.CRAFTING - && r.getType() != AllRecipeTypes.MECHANICAL_CRAFTING.getType()) && (r instanceof ShapedRecipe) - && !AllRecipeTypes.isManualRecipe(r)) + && r.getType() != AllRecipeTypes.MECHANICAL_CRAFTING.getType()) && (r instanceof IShapedRecipe) + && !AllRecipeTypes.isManualRecipe(r)) .catalyst(AllBlocks.MECHANICAL_CRAFTER::get) .enableWhen(c -> c.allowRegularCraftingInCrafter) .build(), diff --git a/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java index fe5b7fa48..9aafdb81b 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java @@ -28,6 +28,7 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.crafting.CraftingRecipe; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.ShapedRecipe; +import net.minecraftforge.common.crafting.IShapedRecipe; public class MechanicalCraftingCategory extends CreateRecipeCategory { @@ -86,11 +87,11 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory ? ((IShapedRecipe) recipe).getRecipeWidth() : 1; } private static int getHeight(CraftingRecipe recipe) { - return recipe instanceof ShapedRecipe ? ((ShapedRecipe) recipe).getHeight() : 1; + return recipe instanceof IShapedRecipe ? ((IShapedRecipe) recipe).getRecipeHeight() : 1; } @Override diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintItem.java index bd5eb9ecf..f4d9d4019 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintItem.java @@ -28,6 +28,7 @@ import net.minecraft.world.item.crafting.Ingredient.Value; import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.level.Level; +import net.minecraftforge.common.crafting.IShapedRecipe; import net.minecraftforge.common.crafting.MultiItemValue; import net.minecraftforge.fml.util.ObfuscationReflectionHelper; import net.minecraftforge.items.ItemStackHandler; @@ -79,12 +80,12 @@ public class BlueprintItem extends Item { inv.setStackInSlot(i, ItemStack.EMPTY); inv.setStackInSlot(9, recipe.getResultItem()); - if (recipe instanceof ShapedRecipe) { - ShapedRecipe shapedRecipe = (ShapedRecipe) recipe; - for (int row = 0; row < shapedRecipe.getHeight(); row++) - for (int col = 0; col < shapedRecipe.getWidth(); col++) + if (recipe instanceof IShapedRecipe) { + IShapedRecipe shapedRecipe = (IShapedRecipe) recipe; + for (int row = 0; row < shapedRecipe.getRecipeHeight(); row++) + for (int col = 0; col < shapedRecipe.getRecipeWidth(); col++) inv.setStackInSlot(row * 3 + col, - convertIngredientToFilter(ingredients.get(row * shapedRecipe.getWidth() + col))); + convertIngredientToFilter(ingredients.get(row * shapedRecipe.getRecipeWidth() + col))); } else { for (int i = 0; i < ingredients.size(); i++) inv.setStackInSlot(i, convertIngredientToFilter(ingredients.get(i)));