|
@@ -24,6 +24,7 @@
|
|
package me.shedaniel.rei.gui.widget;
|
|
package me.shedaniel.rei.gui.widget;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
+import com.google.common.collect.Sets;
|
|
import me.shedaniel.clothconfig2.ClothConfigInitializer;
|
|
import me.shedaniel.clothconfig2.ClothConfigInitializer;
|
|
import me.shedaniel.clothconfig2.api.ScissorsHandler;
|
|
import me.shedaniel.clothconfig2.api.ScissorsHandler;
|
|
import me.shedaniel.clothconfig2.api.ScrollingContainer;
|
|
import me.shedaniel.clothconfig2.api.ScrollingContainer;
|
|
@@ -47,7 +48,9 @@ import org.jetbrains.annotations.ApiStatus;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
|
|
-import java.util.*;
|
|
|
|
|
|
+import java.util.Collections;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Set;
|
|
|
|
|
|
import static me.shedaniel.rei.gui.widget.EntryListWidget.*;
|
|
import static me.shedaniel.rei.gui.widget.EntryListWidget.*;
|
|
|
|
|
|
@@ -187,12 +190,12 @@ public class FavoritesListWidget extends WidgetWithBounds {
|
|
if (ConfigObject.getInstance().doSearchFavorites()) {
|
|
if (ConfigObject.getInstance().doSearchFavorites()) {
|
|
List<EntryStack> list = Lists.newArrayList();
|
|
List<EntryStack> list = Lists.newArrayList();
|
|
boolean checkCraftable = ConfigManager.getInstance().isCraftableOnlyEnabled() && !ScreenHelper.inventoryStacks.isEmpty();
|
|
boolean checkCraftable = ConfigManager.getInstance().isCraftableOnlyEnabled() && !ScreenHelper.inventoryStacks.isEmpty();
|
|
- Set<EntryStack> workingItems = checkCraftable ? new TreeSet<>(Comparator.comparing(EntryStack::hashIgnoreAmount)) : null;
|
|
|
|
|
|
+ Set<Integer> workingItems = checkCraftable ? Sets.newHashSet() : null;
|
|
if (checkCraftable)
|
|
if (checkCraftable)
|
|
- workingItems.addAll(RecipeHelper.getInstance().findCraftableEntriesByItems(CollectionUtils.map(ScreenHelper.inventoryStacks, EntryStack::create)));
|
|
|
|
|
|
+ workingItems.addAll(CollectionUtils.map(RecipeHelper.getInstance().findCraftableEntriesByItems(CollectionUtils.map(ScreenHelper.inventoryStacks, EntryStack::create)), EntryStack::hashIgnoreAmount));
|
|
for (EntryStack stack : ConfigObject.getInstance().getFavorites()) {
|
|
for (EntryStack stack : ConfigObject.getInstance().getFavorites()) {
|
|
if (listWidget.canLastSearchTermsBeAppliedTo(stack)) {
|
|
if (listWidget.canLastSearchTermsBeAppliedTo(stack)) {
|
|
- if (checkCraftable && workingItems.contains(stack))
|
|
|
|
|
|
+ if (checkCraftable && !workingItems.contains(stack.hashIgnoreAmount()))
|
|
continue;
|
|
continue;
|
|
list.add(stack.copy().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE).setting(EntryStack.Settings.Item.RENDER_ENCHANTMENT_GLINT, RENDER_ENCHANTMENT_GLINT));
|
|
list.add(stack.copy().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE).setting(EntryStack.Settings.Item.RENDER_ENCHANTMENT_GLINT, RENDER_ENCHANTMENT_GLINT));
|
|
}
|
|
}
|
|
@@ -208,11 +211,11 @@ public class FavoritesListWidget extends WidgetWithBounds {
|
|
} else {
|
|
} else {
|
|
List<EntryStack> list = Lists.newArrayList();
|
|
List<EntryStack> list = Lists.newArrayList();
|
|
boolean checkCraftable = ConfigManager.getInstance().isCraftableOnlyEnabled() && !ScreenHelper.inventoryStacks.isEmpty();
|
|
boolean checkCraftable = ConfigManager.getInstance().isCraftableOnlyEnabled() && !ScreenHelper.inventoryStacks.isEmpty();
|
|
- Set<EntryStack> workingItems = checkCraftable ? new TreeSet<>(Comparator.comparing(EntryStack::hashIgnoreAmount)) : null;
|
|
|
|
|
|
+ Set<Integer> workingItems = checkCraftable ? Sets.newHashSet() : null;
|
|
if (checkCraftable)
|
|
if (checkCraftable)
|
|
- workingItems.addAll(RecipeHelper.getInstance().findCraftableEntriesByItems(CollectionUtils.map(ScreenHelper.inventoryStacks, EntryStack::create)));
|
|
|
|
|
|
+ workingItems.addAll(CollectionUtils.map(RecipeHelper.getInstance().findCraftableEntriesByItems(CollectionUtils.map(ScreenHelper.inventoryStacks, EntryStack::create)), EntryStack::hashIgnoreAmount));
|
|
for (EntryStack stack : ConfigObject.getInstance().getFavorites()) {
|
|
for (EntryStack stack : ConfigObject.getInstance().getFavorites()) {
|
|
- if (checkCraftable && workingItems.contains(stack))
|
|
|
|
|
|
+ if (checkCraftable && !workingItems.contains(stack.hashIgnoreAmount()))
|
|
continue;
|
|
continue;
|
|
list.add(stack.copy().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE).setting(EntryStack.Settings.Item.RENDER_ENCHANTMENT_GLINT, RENDER_ENCHANTMENT_GLINT));
|
|
list.add(stack.copy().setting(EntryStack.Settings.RENDER_COUNTS, EntryStack.Settings.FALSE).setting(EntryStack.Settings.Item.RENDER_ENCHANTMENT_GLINT, RENDER_ENCHANTMENT_GLINT));
|
|
}
|
|
}
|