From edddba6991e08a89c53ffcb87b5524bb8487b14d Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Tue, 16 Jul 2024 18:58:21 -0400 Subject: [PATCH] Fix searching in latest JEI --- common/build.gradle | 2 +- .../modernfix/searchtree/JEIBackedSearchTree.java | 12 ++++++------ forge/src/main/resources/META-INF/mods.toml | 2 +- gradle.properties | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/build.gradle b/common/build.gradle index b8323bc4f..726d676d6 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -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 diff --git a/common/src/main/java/org/embeddedt/modernfix/searchtree/JEIBackedSearchTree.java b/common/src/main/java/org/embeddedt/modernfix/searchtree/JEIBackedSearchTree.java index 1c7ecd412..43a044ed9 100644 --- a/common/src/main/java/org/embeddedt/modernfix/searchtree/JEIBackedSearchTree.java +++ b/common/src/main/java/org/embeddedt/modernfix/searchtree/JEIBackedSearchTree.java @@ -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; @@ -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. @@ -72,19 +72,19 @@ public List search(String pSearchText) { private List searchJEI(IngredientFilter filter, String pSearchText) { if(!pSearchText.equals(lastSearchText)) { listCache.clear(); - List> ingredients; + Stream> ingredients; String finalSearchTerm = filteringByTag ? ("$" + pSearchText) : pSearchText; try { - ingredients = (List>)getIngredientListUncached.invokeExact(filter, finalSearchTerm); + ingredients = (Stream>)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; diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 1f6bdc705..6e0074a54 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -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" diff --git a/gradle.properties b/gradle.properties index 8b807342f..eb8600259 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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