mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-26 14:25:20 +00:00
Fix fuzzy lookup with primitive-backed network list (#1163)
This commit is contained in:
1 parent
fa44bcafb5
commit
ada1f64b86
1 file changed
+27
-3
@@ -245,7 +245,12 @@ public class NetworkItemList<T extends IAEStack> implements IItemList<T> {
|
||||
|
||||
@Override
|
||||
public Collection<T> findFuzzy(final T input, final FuzzyMode fuzzy) {
|
||||
return buildFinalItemList().findFuzzy(input, fuzzy);
|
||||
final IAEStackType<T> stackType = getStackType();
|
||||
if (stackType == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return buildFinalItemList(stackType.createList()).findFuzzy(input, fuzzy);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -255,8 +260,27 @@ public class NetworkItemList<T extends IAEStack> implements IItemList<T> {
|
||||
|
||||
@Override
|
||||
public @Nullable IAEStackType<T> getStackType() {
|
||||
IItemList<T> list = networkItemLists.values().stream().findAny().orElse(null);
|
||||
return list == null ? null : list.getStackType();
|
||||
return findStackType(new HashSet<>());
|
||||
}
|
||||
|
||||
private @Nullable IAEStackType<T> findStackType(Set<NetworkItemList<T>> visitedLists) {
|
||||
if (!visitedLists.add(this)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (IItemList<T> list : networkItemLists.values()) {
|
||||
final IAEStackType<T> stackType;
|
||||
if (list instanceof NetworkItemList) {
|
||||
stackType = ((NetworkItemList<T>) list).findStackType(visitedLists);
|
||||
} else {
|
||||
stackType = list.getStackType();
|
||||
}
|
||||
if (stackType != null) {
|
||||
return stackType;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static class NetworkItemStack<U extends IAEStack> {
|
||||
|
||||
Reference in new issue
Block a user