Recipe Stages

Recipe Stages

28M Downloads

JEI sees some staged shaped recipes as shapeless

sam-kirby opened this issue ยท 2 comments

commented

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.

Ref: https://github.com/jaredlll08/RecipeStages/blob/master/src/main/java/com/blamejared/recipestages/handlers/Recipes.java#L372-L378

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.*");

Screenshot 2019-07-29 at 12 55 21

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.

Screenshot 2019-07-29 at 13 06 54

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);
commented

I'm also experiencing this issue with staged recipes for embers pipes, would love if this could be fixed soon.

commented