JEI sees some staged shaped recipes as shapeless
sam-kirby opened this issue ยท 2 comments
RecipeStages: 1.1.1
CraftTweaker: 4.1.18
JEI: 4.15.0.283
GameStages: 2.0.115
Bookshelf: 2.3.581
When a staged recipe is restaged, it is always constructed as shapeless regardless of whether the underlying recipe is shaped or shapeless. This is as a result of RecipeStage
not implementing IShapedRecipe (as it can be shaped or shapeless), though this is the only thing checked in com.blamejared.recipestages.handlers.Recipes#replaceRecipe
when determining if a recipe is shaped.
The below script illustrates this issue.
import mods.recipestages.Recipes;
Recipes.setRecipeStage("zero", <minecraft:gold_block>);
recipes.addShaped("irongold", <minecraft:gold_block>,
[[<minecraft:iron_ingot>, <minecraft:gold_ingot>],
[<minecraft:iron_ingot>, <minecraft:gold_ingot>],
[<minecraft:iron_ingot>, <minecraft:gold_ingot>]]);
Recipes.setRecipeStageByRegex("one", ".*irongold.*");
Here if you follow JEI's instructions, you cannot craft a gold block from iron and gold ingots.
This may seem contrived, however it is a pattern used extensively in SevTech, where an item and by extension its recipes are assigned to a specific stage using ItemStages. Additional recipes are added that make crafting said item easier in future ages, and these are named and staged using regex. I attach below a screenshot of the Charcoal Wopper recipes. Note that recipes assigned to stage 1 and 2 are in fact shaped and require that the lava wood be placed above the hopper/wopper.
I attach below a potential solution.
diff --git a/src/main/java/com/blamejared/recipestages/handlers/Recipes.java b/src/main/java/com/blamejared/recipestages/handlers/Recipes.java
index 11fad32..938a6b2 100644
--- a/src/main/java/com/blamejared/recipestages/handlers/Recipes.java
+++ b/src/main/java/com/blamejared/recipestages/handlers/Recipes.java
@@ -373,6 +373,9 @@ public class Recipes {
if(iRecipe instanceof IShapedRecipe) {
width = ((IShapedRecipe) iRecipe).getRecipeWidth();
height = ((IShapedRecipe) iRecipe).getRecipeHeight();
+ } else if (iRecipe instanceof RecipeStage && !((RecipeStage) iRecipe).isShapeless()) {
+ width = ((RecipeStage) iRecipe).getWidth();
+ height = ((RecipeStage) iRecipe).getHeight();
}
boolean shapeless = (width == 0 && height == 0);
I'm also experiencing this issue with staged recipes for embers pipes, would love if this could be fixed soon.