diff --git a/Gui/src/main/java/mezz/jei/gui/search/ElementSearch.java b/Gui/src/main/java/mezz/jei/gui/search/ElementSearch.java index 52d56f04c..0b6fb6340 100644 --- a/Gui/src/main/java/mezz/jei/gui/search/ElementSearch.java +++ b/Gui/src/main/java/mezz/jei/gui/search/ElementSearch.java @@ -22,6 +22,7 @@ public class ElementSearch implements IElementSearch { private final Map, IListElement>, PrefixedSearchable, IListElement>> prefixedSearchables = new IdentityHashMap<>(); private final CombinedSearchables> combinedSearchables = new CombinedSearchables<>(); + private final Set> allElements = Collections.newSetFromMap(new IdentityHashMap<>()); public ElementSearch(ElementPrefixParser elementPrefixParser) { for (PrefixInfo, IListElement> prefixInfo : elementPrefixParser.allPrefixInfos()) { @@ -57,6 +58,7 @@ public Set> getSearchResults(ElementPrefixParser.TokenInfo token @Override public void add(IListElementInfo info) { + this.allElements.add(info.getElement()); for (PrefixedSearchable, IListElement> prefixedSearchable : this.prefixedSearchables.values()) { SearchMode searchMode = prefixedSearchable.getMode(); if (searchMode != SearchMode.DISABLED) { @@ -71,6 +73,9 @@ public void add(IListElementInfo info) { @Override public void addAll(Collection> infos) { + for (IListElementInfo info : infos) { + this.allElements.add(info.getElement()); + } for (PrefixedSearchable, IListElement> prefixedSearchable : this.prefixedSearchables.values()) { SearchMode searchMode = prefixedSearchable.getMode(); if (searchMode != SearchMode.DISABLED) { @@ -87,10 +92,7 @@ public void addAll(Collection> infos) { @Override public Set> getAllIngredients() { - Set> results = Collections.newSetFromMap(new IdentityHashMap<>()); - PrefixedSearchable, IListElement> noPrefixSearchables = this.prefixedSearchables.get(ElementPrefixParser.NO_PREFIX); - noPrefixSearchables.getAllElements(results::addAll); - return results; + return Collections.unmodifiableSet(allElements); } @Override