Skip to content

Commit

Permalink
Fix searching in latest JEI
Browse files Browse the repository at this point in the history
  • Loading branch information
embeddedt committed Jul 16, 2024
1 parent bc7aa55 commit edddba6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ architectury {
common(rootProject.enabled_platforms.split(","))
}

ext.jei_minecraft_version = "1.19.4" /* temporary, till 1.20 releases */
ext.jei_minecraft_version = "1.20.1" /* temporary, till 1.20 releases */

dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.embeddedt.modernfix.searchtree;

import com.google.common.collect.ImmutableList;
import mezz.jei.api.ingredients.ITypedIngredient;
import mezz.jei.gui.ingredients.IngredientFilter;
import mezz.jei.gui.ingredients.IngredientFilterApi;
Expand All @@ -18,6 +17,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;

/**
* Uses JEI to handle search tree lookups.
Expand Down Expand Up @@ -72,19 +72,19 @@ public List<ItemStack> search(String pSearchText) {
private List<ItemStack> searchJEI(IngredientFilter filter, String pSearchText) {
if(!pSearchText.equals(lastSearchText)) {
listCache.clear();
List<ITypedIngredient<?>> ingredients;
Stream<ITypedIngredient<?>> ingredients;
String finalSearchTerm = filteringByTag ? ("$" + pSearchText) : pSearchText;
try {
ingredients = (List<ITypedIngredient<?>>)getIngredientListUncached.invokeExact(filter, finalSearchTerm);
ingredients = (Stream<ITypedIngredient<?>>)getIngredientListUncached.invokeExact(filter, finalSearchTerm);
} catch(Throwable e) {
ModernFix.LOGGER.error("Error searching", e);
ingredients = ImmutableList.of();
ingredients = Stream.empty();
}
for(ITypedIngredient<?> ingredient : ingredients) {
ingredients.forEach(ingredient -> {
if(ingredient.getIngredient() instanceof ItemStack) {
listCache.add((ItemStack)ingredient.getIngredient());
}
}
});
lastSearchText = pSearchText;
}
return listCache;
Expand Down
2 changes: 1 addition & 1 deletion forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ side = "BOTH"
modId = "jei"
mandatory = false
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange = "[13,)"
versionRange = "[15.8.0.11,)"
ordering = "BEFORE"
side = "CLIENT"
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enabled_platforms=fabric,forge
forge_version=1.20.1-47.1.3
parchment_version=2023.07.09
refined_storage_version=4392788
jei_version=13.1.0.2
jei_version=15.8.0.11
rei_version=11.0.597
ctm_version=1.20.1-1.1.8+4
kubejs_version=1902.6.0-build.142
Expand Down

0 comments on commit edddba6

Please sign in to comment.