4040import  java .util .stream .Collectors ;
4141
4242public  class  RecipeLayoutBuilder <T > implements  IRecipeLayoutBuilder  {
43- 	private  final  List <RecipeSlotBuilder > slots  = new  ArrayList <>();
43+ 	private  final  List <RecipeSlotBuilder > visibleSlots  = new  ArrayList <>();
4444	private  final  List <List <RecipeSlotBuilder >> focusLinkedSlots  = new  ArrayList <>();
4545
4646	private  final  IIngredientManager  ingredientManager ;
@@ -68,7 +68,7 @@ public IRecipeSlotBuilder addSlot(RecipeIngredientRole role) {
6868			addOutputSlotTooltipCallback (slot );
6969		}
7070
71- 		this .slots .add (slot );
71+ 		this .visibleSlots .add (slot );
7272		return  slot ;
7373	}
7474
@@ -83,7 +83,7 @@ public IRecipeSlotBuilder addSlotToWidget(RecipeIngredientRole role, mezz.jei.ap
8383			addOutputSlotTooltipCallback (slot );
8484		}
8585
86- 		this .slots .add (slot );
86+ 		this .visibleSlots .add (slot );
8787		return  slot ;
8888	}
8989
@@ -175,6 +175,9 @@ public RecipeLayout<T> buildRecipeLayout(
175175				focusMatches .addAll (slot .getMatches (focuses ));
176176			}
177177			for  (RecipeSlotBuilder  slotBuilder  : linkedSlots ) {
178+ 				if  (!visibleSlots .contains (slotBuilder )) {
179+ 					continue ;
180+ 				}
178181				mezz .jei .api .gui .widgets .ISlottedWidgetFactory <?> assignedWidget  = slotBuilder .getAssignedWidget ();
179182				Pair <Integer , IRecipeSlotDrawable > slotDrawable  = slotBuilder .build (focusMatches , cycleTicker );
180183				if  (assignedWidget  == null ) {
@@ -187,7 +190,7 @@ public RecipeLayout<T> buildRecipeLayout(
187190			focusLinkedSlots .addAll (linkedSlots );
188191		}
189192
190- 		for  (RecipeSlotBuilder  slotBuilder  : slots ) {
193+ 		for  (RecipeSlotBuilder  slotBuilder  : visibleSlots ) {
191194			if  (!focusLinkedSlots .contains (slotBuilder )) {
192195				mezz .jei .api .gui .widgets .ISlottedWidgetFactory <?> assignedWidget  = slotBuilder .getAssignedWidget ();
193196				Pair <Integer , IRecipeSlotDrawable > slotDrawable  = slotBuilder .build (focuses , cycleTicker );
0 commit comments