Skip to content

Commit e5bf20b

Browse files
committed
Prevent displaying invisible focus-linked slots
1 parent 3efb0e2 commit e5bf20b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Library/src/main/java/mezz/jei/library/gui/recipes/layout/builder/RecipeLayoutBuilder.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import java.util.Set;
3939

4040
public 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

Comments
 (0)