3838import  java .util .Set ;
3939
4040public  class  RecipeLayoutBuilder <T > implements  IRecipeLayoutBuilder  {
41- 	private  final  List <RecipeSlotBuilder > slots  = new  ArrayList <>();
41+ 	private  final  List <RecipeSlotBuilder > visibleSlots  = new  ArrayList <>();
4242	private  final  List <List <RecipeSlotBuilder >> focusLinkedSlots  = new  ArrayList <>();
4343
4444	private  final  IIngredientManager  ingredientManager ;
@@ -66,7 +66,7 @@ public IRecipeSlotBuilder addSlot(RecipeIngredientRole role) {
6666			addOutputSlotTooltipCallback (slot );
6767		}
6868
69- 		this .slots .add (slot );
69+ 		this .visibleSlots .add (slot );
7070		return  slot ;
7171	}
7272
@@ -81,7 +81,7 @@ public IRecipeSlotBuilder addSlotToWidget(RecipeIngredientRole role, mezz.jei.ap
8181			addOutputSlotTooltipCallback (slot );
8282		}
8383
84- 		this .slots .add (slot );
84+ 		this .visibleSlots .add (slot );
8585		return  slot ;
8686	}
8787
@@ -173,6 +173,9 @@ public RecipeLayout<T> buildRecipeLayout(
173173				focusMatches .addAll (slot .getMatches (focuses ));
174174			}
175175			for  (RecipeSlotBuilder  slotBuilder  : linkedSlots ) {
176+ 				if  (!visibleSlots .contains (slotBuilder )) {
177+ 					continue ;
178+ 				}
176179				mezz .jei .api .gui .widgets .ISlottedWidgetFactory <?> assignedWidget  = slotBuilder .getAssignedWidget ();
177180				Pair <Integer , IRecipeSlotDrawable > slotDrawable  = slotBuilder .build (focusMatches , cycleTicker );
178181				if  (assignedWidget  == null ) {
@@ -185,7 +188,7 @@ public RecipeLayout<T> buildRecipeLayout(
185188			focusLinkedSlots .addAll (linkedSlots );
186189		}
187190
188- 		for  (RecipeSlotBuilder  slotBuilder  : slots ) {
191+ 		for  (RecipeSlotBuilder  slotBuilder  : visibleSlots ) {
189192			if  (!focusLinkedSlots .contains (slotBuilder )) {
190193				mezz .jei .api .gui .widgets .ISlottedWidgetFactory <?> assignedWidget  = slotBuilder .getAssignedWidget ();
191194				Pair <Integer , IRecipeSlotDrawable > slotDrawable  = slotBuilder .build (focuses , cycleTicker );
0 commit comments