EMI

EMI

14M Downloads

getRecipeContext method always returns null

wintercoresystem opened this issue ยท 3 comments

commented

Bug Report: getRecipeContext Always Returns Null

Issue Description

The getRecipeContext method consistently returns null, causing dependent methods in EMIScreenManager (such as Stack Tree functionality) to fail.

Steps to Reproduce

  1. Trigger a method in EMIScreenManager that relies on getRecipeContext (e.g., Stack Tree).
  2. Observe failures due to missing context (Tree won't show because context is null).
  3. Debug logs confirm context is null for all interactions.

Actual Behavior

  • Debug output:
    stack: dev.emi.emi.api.stack.EmiStackInteraction@77366ad3  
    ingredient: minecraft:oak_planks x31  
    context: null  
    stack: dev.emi.emi.api.stack.EmiStackInteraction@16086a5d  
    ingredient: dev.emi.emi.api.stack.TagEmiIngredient@d6342d48  
    context: null  
    
  • Methods using context fail silently or throw errors.

Expected Behavior

getRecipeContext should return a valid RecipeContext object (non-null) when interacting with stacks/ingredients, enabling features like Stack Tree to function correctly.

Environment

  • Mod Version: emi 1.1.22-SNAPSHOT+1.21.1+fabric
  • Game Version: Minecraft 1.21
  • Loader: Fabric
  • Reproducibility: Consistent

Additional Context

  • Code Snippet (from logs):
    if (EmiConfig.cheatMode) { ... }
    System.out.printf("stack: %s\n", stack);  
    System.out.printf("ingredient: %s\n", ingredient);  
    System.out.printf("context: %s\n", context); // Always null  
    if (function.apply(EmiConfig.viewRecipes)) { ... }
commented

Recipe context only exists on stacks that have an associated recipe, like recipe favorites. A majority of stacks will have a null recipe context.

commented

Am I missing something then? I set default recipe and favorite input and output ingredients, still got null.

Image

Output in stdout:

stack: dev.emi.emi.api.stack.EmiStackInteraction@72fa83b
ingredient: minecraft:oak_log x6
context: null
stack: dev.emi.emi.api.stack.EmiStackInteraction@3ea102
ingredient: minecraft:torch x64
context: null
stack: dev.emi.emi.api.stack.EmiStackInteraction@44f1972c
ingredient: minecraft:stick x11
context: null
stack: dev.emi.emi.api.stack.EmiStackInteraction@3a02dd8c
ingredient: minecraft:coal
commented

Ok, I figured I can use it instead of widget by using "View stack tree" shortcut on recipe output. I though that I can just press this shortcut on any item on sidebar or inventory...