diff --git a/CommonApi/src/main/java/mezz/jei/api/IModPlugin.java b/CommonApi/src/main/java/mezz/jei/api/IModPlugin.java index de895af4f..7c39b48d2 100644 --- a/CommonApi/src/main/java/mezz/jei/api/IModPlugin.java +++ b/CommonApi/src/main/java/mezz/jei/api/IModPlugin.java @@ -2,6 +2,7 @@ import mezz.jei.api.helpers.IPlatformFluidHelper; import mezz.jei.api.registration.IRuntimeRegistration; +import mezz.jei.api.registration.ISearchRegistration; import net.minecraft.resources.ResourceLocation; import mezz.jei.api.registration.IAdvancedRegistration; @@ -81,6 +82,15 @@ default void registerRecipeTransferHandlers(IRecipeTransferRegistration registra } + /** + * Register special handlers related to searching ingredients. + * + * @since 12.2.0 + */ + default void registerSearch(ISearchRegistration registration) { + + } + /** * Register recipe catalysts. * Recipe Catalysts are ingredients that are needed in order to craft other things. diff --git a/CommonApi/src/main/java/mezz/jei/api/registration/IRuntimeRegistration.java b/CommonApi/src/main/java/mezz/jei/api/registration/IRuntimeRegistration.java index d731cb2e2..fcede4032 100644 --- a/CommonApi/src/main/java/mezz/jei/api/registration/IRuntimeRegistration.java +++ b/CommonApi/src/main/java/mezz/jei/api/registration/IRuntimeRegistration.java @@ -11,6 +11,9 @@ import mezz.jei.api.runtime.IIngredientVisibility; import mezz.jei.api.runtime.IRecipesGui; import mezz.jei.api.runtime.IScreenHelper; +import mezz.jei.api.search.ILanguageTransformer; + +import java.util.Collection; /** * Allows mods to override the runtime classes for JEI with their own implementation. @@ -88,4 +91,12 @@ public interface IRuntimeRegistration { * This is used by JEI's GUI and can be used by other mods that want to use the same information from JEI. */ IEditModeConfig getEditModeConfig(); + + /** + * Get the language transformers registered by plugins with {@link ISearchRegistration#addLanguageTransformer}. + * + * @see ILanguageTransformer + * @since 12.2.0 + */ + Collection getLanguageTransformers(); } diff --git a/CommonApi/src/main/java/mezz/jei/api/registration/ISearchRegistration.java b/CommonApi/src/main/java/mezz/jei/api/registration/ISearchRegistration.java new file mode 100644 index 000000000..3772902f0 --- /dev/null +++ b/CommonApi/src/main/java/mezz/jei/api/registration/ISearchRegistration.java @@ -0,0 +1,26 @@ +package mezz.jei.api.registration; + +import mezz.jei.api.IModPlugin; +import mezz.jei.api.helpers.IJeiHelpers; +import mezz.jei.api.search.ILanguageTransformer; + +/** + * The {@link ISearchRegistration} instance is passed to your mod plugin in {@link IModPlugin#registerSearch(ISearchRegistration)}. + * + * @since 12.2.0 + */ +public interface ISearchRegistration { + /** + * {@link IJeiHelpers} provides helpers and tools for addon mods. + * + * @since 12.2.0 + */ + IJeiHelpers getJeiHelpers(); + + /** + * Register your own {@link ILanguageTransformer} here. + * + * @since 12.2.0 + */ + void addLanguageTransformer(ILanguageTransformer languageTransformer); +} diff --git a/CommonApi/src/main/java/mezz/jei/api/search/ILanguageTransformer.java b/CommonApi/src/main/java/mezz/jei/api/search/ILanguageTransformer.java new file mode 100644 index 000000000..1ca180da6 --- /dev/null +++ b/CommonApi/src/main/java/mezz/jei/api/search/ILanguageTransformer.java @@ -0,0 +1,31 @@ +package mezz.jei.api.search; + +import net.minecraft.resources.ResourceLocation; + +/** + * A language transformer lets you change string tokens that are added to the search tree. + * + * This is useful for some languages where there may be multiple ways + * to type the same thing, and the transformer can change the text. + * For example, "nihao" can be transformed to match "你好". + * + * @since 12.2.0 + */ +public interface ILanguageTransformer { + /** + * Get the unique ID for this language transformer. + */ + ResourceLocation getId(); + + /** + * Change the token into something else. + * + * This is called before inserting any ingredients into the search tree, + * and also for looking up ingredients in the search tree. + * + * In order to work, this must always be consistent. + * For an input string, it must always return the same output + * string every time it is called. + */ + String transformToken(String token); +} diff --git a/CommonApi/src/main/java/mezz/jei/api/search/package-info.java b/CommonApi/src/main/java/mezz/jei/api/search/package-info.java new file mode 100644 index 000000000..c0bc86e84 --- /dev/null +++ b/CommonApi/src/main/java/mezz/jei/api/search/package-info.java @@ -0,0 +1,7 @@ +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +package mezz.jei.api.search; + +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/Core/src/main/java/mezz/jei/core/search/suffixtree/GeneralizedSuffixTree.java b/Core/src/main/java/mezz/jei/core/search/suffixtree/GeneralizedSuffixTree.java index e8d42b0b5..0001a6a61 100644 --- a/Core/src/main/java/mezz/jei/core/search/suffixtree/GeneralizedSuffixTree.java +++ b/Core/src/main/java/mezz/jei/core/search/suffixtree/GeneralizedSuffixTree.java @@ -25,7 +25,7 @@ /** * A Generalized Suffix Tree, based on the Ukkonen's paper "On-line construction of suffix trees" - * http://www.cs.helsinki.fi/u/ukkonen/SuffixT1withFigs.pdf + * SuffixT1withFigs.pdf *

* Allows for fast storage and fast(er) retrieval by creating a tree-based index out of a set of strings. * Unlike common suffix trees, which are generally used to build an index out of one (very) long string, diff --git a/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java b/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java index 61f913406..5323bdaf8 100644 --- a/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java +++ b/Forge/src/test/java/mezz/jei/test/IngredientFilterTest.java @@ -7,6 +7,7 @@ import mezz.jei.api.runtime.IEditModeConfig; import mezz.jei.api.runtime.IIngredientManager; import mezz.jei.api.runtime.IIngredientVisibility; +import mezz.jei.api.search.ILanguageTransformer; import mezz.jei.common.util.Translator; import mezz.jei.common.config.IWorldConfig; import mezz.jei.gui.config.IClientConfig; @@ -86,6 +87,7 @@ public void setup() { IIngredientSorter ingredientListSorter = (a, b) -> Comparator.comparing(IListElementInfo::getModNameForSorting); this.ingredientVisibility = new IngredientVisibility(blacklist, worldConfig, editModeConfig, ingredientManager); this.filterTextSource = new FilterTextSource(); + List languageTransformers = List.of(); this.ingredientFilter = new IngredientFilter( filterTextSource, clientConfig, @@ -95,7 +97,8 @@ public void setup() { baseList, modIdHelper, ingredientVisibility, - colorHelper + colorHelper, + languageTransformers ); this.ingredientManager.registerIngredientListener(ingredientFilter); diff --git a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientFilter.java b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientFilter.java index 2f825f864..933a3833e 100644 --- a/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientFilter.java +++ b/Gui/src/main/java/mezz/jei/gui/ingredients/IngredientFilter.java @@ -8,6 +8,7 @@ import mezz.jei.api.ingredients.subtypes.UidContext; import mezz.jei.api.runtime.IIngredientManager; import mezz.jei.api.runtime.IIngredientVisibility; +import mezz.jei.api.search.ILanguageTransformer; import mezz.jei.common.config.DebugConfig; import mezz.jei.common.util.Translator; import mezz.jei.gui.config.IClientConfig; @@ -67,7 +68,8 @@ public IngredientFilter( NonNullList> ingredients, IModIdHelper modIdHelper, IIngredientVisibility ingredientVisibility, - IColorHelper colorHelper + IColorHelper colorHelper, + Collection languageTransformers ) { this.filterTextSource = filterTextSource; this.ingredientManager = ingredientManager; @@ -77,9 +79,9 @@ public IngredientFilter( this.elementPrefixParser = new ElementPrefixParser(ingredientManager, config, colorHelper); if (clientConfig.isLowMemorySlowSearchEnabled()) { - this.elementSearch = new ElementSearchLowMem(); + this.elementSearch = new ElementSearchLowMem(languageTransformers); } else { - this.elementSearch = new ElementSearch(this.elementPrefixParser); + this.elementSearch = new ElementSearch(this.elementPrefixParser, languageTransformers); } LOGGER.info("Adding {} ingredients", ingredients.size()); 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 ef51410a3..c743f0ab7 100644 --- a/Gui/src/main/java/mezz/jei/gui/search/ElementSearch.java +++ b/Gui/src/main/java/mezz/jei/gui/search/ElementSearch.java @@ -1,5 +1,6 @@ package mezz.jei.gui.search; +import mezz.jei.api.search.ILanguageTransformer; import mezz.jei.core.search.CombinedSearchables; import mezz.jei.core.search.ISearchStorage; import mezz.jei.core.search.ISearchable; @@ -9,10 +10,12 @@ import mezz.jei.gui.ingredients.IListElementInfo; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Unmodifiable; import java.util.Collection; import java.util.Collections; import java.util.IdentityHashMap; +import java.util.List; import java.util.Map; import java.util.Set; @@ -21,8 +24,11 @@ public class ElementSearch implements IElementSearch { private final Map>, PrefixedSearchable>> prefixedSearchables = new IdentityHashMap<>(); private final CombinedSearchables> combinedSearchables = new CombinedSearchables<>(); + @Unmodifiable + private final List languageTransformers; - public ElementSearch(ElementPrefixParser elementPrefixParser) { + public ElementSearch(ElementPrefixParser elementPrefixParser, Collection languageTransformers) { + this.languageTransformers = List.copyOf(languageTransformers); for (PrefixInfo> prefixInfo : elementPrefixParser.allPrefixInfos()) { ISearchStorage> storage = prefixInfo.createStorage(); var prefixedSearchable = new PrefixedSearchable<>(storage, prefixInfo); @@ -33,7 +39,7 @@ public ElementSearch(ElementPrefixParser elementPrefixParser) { @Override public Set> getSearchResults(ElementPrefixParser.TokenInfo tokenInfo) { - String token = tokenInfo.token(); + String token = transform(tokenInfo.token()); if (token.isEmpty()) { return Set.of(); } @@ -62,6 +68,7 @@ public void add(IListElementInfo info) { Collection strings = prefixedSearchable.getStrings(info); ISearchStorage> searchable = prefixedSearchable.getSearchStorage(); for (String string : strings) { + string = transform(string); searchable.put(string, info); } } @@ -84,4 +91,11 @@ public void logStatistics() { } }); } + + private String transform(String string) { + for (ILanguageTransformer languageTransformer : languageTransformers) { + string = languageTransformer.transformToken(string); + } + return string; + } } diff --git a/Gui/src/main/java/mezz/jei/gui/search/ElementSearchLowMem.java b/Gui/src/main/java/mezz/jei/gui/search/ElementSearchLowMem.java index b2977fe55..6f5de5864 100644 --- a/Gui/src/main/java/mezz/jei/gui/search/ElementSearchLowMem.java +++ b/Gui/src/main/java/mezz/jei/gui/search/ElementSearchLowMem.java @@ -1,10 +1,12 @@ package mezz.jei.gui.search; +import mezz.jei.api.search.ILanguageTransformer; import mezz.jei.core.search.PrefixInfo; import mezz.jei.gui.ingredients.IListElement; import mezz.jei.gui.ingredients.IListElementInfo; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Unmodifiable; import java.util.ArrayList; import java.util.Collection; @@ -17,14 +19,17 @@ public class ElementSearchLowMem implements IElementSearch { private static final Logger LOGGER = LogManager.getLogger(); private final List> elementInfoList; + @Unmodifiable + private final List languageTransformers; - public ElementSearchLowMem() { + public ElementSearchLowMem(Collection languageTransformers) { + this.languageTransformers = List.copyOf(languageTransformers); this.elementInfoList = new ArrayList<>(); } @Override public Set> getSearchResults(ElementPrefixParser.TokenInfo tokenInfo) { - String token = tokenInfo.token(); + String token = transform(tokenInfo.token()); if (token.isEmpty()) { return Set.of(); } @@ -35,11 +40,19 @@ public Set> getSearchResults(ElementPrefixParser.TokenInfo t .collect(Collectors.toSet()); } - private static boolean matches(String word, PrefixInfo> prefixInfo, IListElementInfo elementInfo) { + private String transform(String string) { + for (ILanguageTransformer languageTransformer : languageTransformers) { + string = languageTransformer.transformToken(string); + } + return string; + } + + private boolean matches(String word, PrefixInfo> prefixInfo, IListElementInfo elementInfo) { IListElement element = elementInfo.getElement(); if (element.isVisible()) { Collection strings = prefixInfo.getStrings(elementInfo); for (String string : strings) { + string = transform(string); if (string.contains(word)) { return true; } diff --git a/Gui/src/main/java/mezz/jei/gui/startup/JeiGuiStarter.java b/Gui/src/main/java/mezz/jei/gui/startup/JeiGuiStarter.java index 876d30e96..35b25ca30 100644 --- a/Gui/src/main/java/mezz/jei/gui/startup/JeiGuiStarter.java +++ b/Gui/src/main/java/mezz/jei/gui/startup/JeiGuiStarter.java @@ -12,6 +12,7 @@ import mezz.jei.api.runtime.IIngredientManager; import mezz.jei.api.runtime.IIngredientVisibility; import mezz.jei.api.runtime.IScreenHelper; +import mezz.jei.api.search.ILanguageTransformer; import mezz.jei.common.Internal; import mezz.jei.common.gui.textures.Textures; import mezz.jei.common.input.IInternalKeyMappings; @@ -54,6 +55,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.util.Collection; import java.util.List; public class JeiGuiStarter { @@ -73,6 +75,7 @@ public static JeiEventHandlers start(IRuntimeRegistration registration) { IIngredientVisibility ingredientVisibility = registration.getIngredientVisibility(); IIngredientManager ingredientManager = registration.getIngredientManager(); IEditModeConfig editModeConfig = registration.getEditModeConfig(); + Collection languageTransformers = registration.getLanguageTransformers(); IJeiHelpers jeiHelpers = registration.getJeiHelpers(); IColorHelper colorHelper = jeiHelpers.getColorHelper(); @@ -113,7 +116,8 @@ public static JeiEventHandlers start(IRuntimeRegistration registration) { ingredientList, modIdHelper, ingredientVisibility, - colorHelper + colorHelper, + languageTransformers ); ingredientManager.registerIngredientListener(ingredientFilter); ingredientVisibility.registerListener(ingredientFilter::onIngredientVisibilityChanged); diff --git a/Library/src/main/java/mezz/jei/library/ingredients/IngredientManager.java b/Library/src/main/java/mezz/jei/library/ingredients/IngredientManager.java index 76a5c7b1e..d3db90257 100644 --- a/Library/src/main/java/mezz/jei/library/ingredients/IngredientManager.java +++ b/Library/src/main/java/mezz/jei/library/ingredients/IngredientManager.java @@ -35,7 +35,6 @@ public Collection getAllIngredients(IIngredientType ingredientType) { .getAllIngredients(); } - @SuppressWarnings("removal") @Override public IIngredientHelper getIngredientHelper(V ingredient) { return getIngredientTypeChecked(ingredient) @@ -52,7 +51,6 @@ public IIngredientHelper getIngredientHelper(IIngredientType ingredien .getIngredientHelper(); } - @SuppressWarnings("removal") @Override public IIngredientRenderer getIngredientRenderer(V ingredient) { return getIngredientTypeChecked(ingredient) diff --git a/Library/src/main/java/mezz/jei/library/load/PluginLoader.java b/Library/src/main/java/mezz/jei/library/load/PluginLoader.java index cf28fedaf..ce7e39e72 100644 --- a/Library/src/main/java/mezz/jei/library/load/PluginLoader.java +++ b/Library/src/main/java/mezz/jei/library/load/PluginLoader.java @@ -19,8 +19,8 @@ import mezz.jei.common.gui.textures.Textures; import mezz.jei.common.platform.IPlatformFluidHelperInternal; import mezz.jei.common.platform.Services; -import mezz.jei.core.util.LoggedTimer; import mezz.jei.common.util.StackHelper; +import mezz.jei.core.util.LoggedTimer; import mezz.jei.library.config.IModIdFormatConfig; import mezz.jei.library.config.RecipeCategorySortingConfig; import mezz.jei.library.focus.FocusFactory; @@ -35,6 +35,7 @@ import mezz.jei.library.load.registration.RecipeCategoryRegistration; import mezz.jei.library.load.registration.RecipeRegistration; import mezz.jei.library.load.registration.RecipeTransferRegistration; +import mezz.jei.library.load.registration.SearchRegistration; import mezz.jei.library.load.registration.SubtypeRegistration; import mezz.jei.library.load.registration.VanillaCategoryExtensionRegistration; import mezz.jei.library.plugins.vanilla.VanillaPlugin; @@ -82,6 +83,13 @@ public PluginLoader(StartData data, IModIdFormatConfig modIdFormatConfig, IColor this.jeiHelpers = new JeiHelpers(guiHelper, stackHelper, modIdHelper, focusFactory, colorHelper, ingredientManager); } + public SearchRegistration registerSearch() { + List plugins = data.plugins(); + SearchRegistration searchRegistration = new SearchRegistration(getJeiHelpers()); + PluginCaller.callOnPlugins("Registering search", plugins, p -> p.registerSearch(searchRegistration)); + return searchRegistration; + } + @Unmodifiable private List> createRecipeCategories(List plugins, VanillaPlugin vanillaPlugin) { RecipeCategoryRegistration recipeCategoryRegistration = new RecipeCategoryRegistration(jeiHelpers); diff --git a/Library/src/main/java/mezz/jei/library/load/registration/RuntimeRegistration.java b/Library/src/main/java/mezz/jei/library/load/registration/RuntimeRegistration.java index 8c330f9d3..a30a03669 100644 --- a/Library/src/main/java/mezz/jei/library/load/registration/RuntimeRegistration.java +++ b/Library/src/main/java/mezz/jei/library/load/registration/RuntimeRegistration.java @@ -12,11 +12,14 @@ import mezz.jei.api.runtime.IIngredientVisibility; import mezz.jei.api.runtime.IRecipesGui; import mezz.jei.api.runtime.IScreenHelper; +import mezz.jei.api.search.ILanguageTransformer; import mezz.jei.library.gui.BookmarkOverlayDummy; import mezz.jei.library.gui.IngredientListOverlayDummy; import mezz.jei.library.gui.recipes.RecipesGuiDummy; import mezz.jei.library.ingredients.IngredientFilterApiDummy; +import java.util.Collection; + public class RuntimeRegistration implements IRuntimeRegistration { private final IRecipeManager recipeManager; private final IJeiHelpers jeiHelpers; @@ -25,6 +28,7 @@ public class RuntimeRegistration implements IRuntimeRegistration { private final IIngredientVisibility ingredientVisibility; private final IRecipeTransferManager recipeTransferManager; private final IScreenHelper screenHelper; + private final Collection languageTransformers; private IIngredientListOverlay ingredientListOverlay = IngredientListOverlayDummy.INSTANCE; private IBookmarkOverlay bookmarkOverlay = BookmarkOverlayDummy.INSTANCE; @@ -38,7 +42,8 @@ public RuntimeRegistration( IIngredientManager ingredientManager, IIngredientVisibility ingredientVisibility, IRecipeTransferManager recipeTransferManager, - IScreenHelper screenHelper + IScreenHelper screenHelper, + Collection languageTransformers ) { this.recipeManager = recipeManager; this.jeiHelpers = jeiHelpers; @@ -47,6 +52,7 @@ public RuntimeRegistration( this.ingredientVisibility = ingredientVisibility; this.recipeTransferManager = recipeTransferManager; this.screenHelper = screenHelper; + this.languageTransformers = languageTransformers; } @Override @@ -104,6 +110,11 @@ public IEditModeConfig getEditModeConfig() { return this.editModeConfig; } + @Override + public Collection getLanguageTransformers() { + return languageTransformers; + } + public IIngredientListOverlay getIngredientListOverlay() { return ingredientListOverlay; } diff --git a/Library/src/main/java/mezz/jei/library/load/registration/SearchRegistration.java b/Library/src/main/java/mezz/jei/library/load/registration/SearchRegistration.java new file mode 100644 index 000000000..26433295d --- /dev/null +++ b/Library/src/main/java/mezz/jei/library/load/registration/SearchRegistration.java @@ -0,0 +1,42 @@ +package mezz.jei.library.load.registration; + +import mezz.jei.api.helpers.IJeiHelpers; +import mezz.jei.api.registration.ISearchRegistration; +import mezz.jei.api.search.ILanguageTransformer; +import mezz.jei.common.util.ErrorUtil; +import net.minecraft.resources.ResourceLocation; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +public class SearchRegistration implements ISearchRegistration { + private static final Logger LOGGER = LogManager.getLogger(); + + private final IJeiHelpers jeiHelpers; + private final Map languageTransformers = new LinkedHashMap<>(); + + public SearchRegistration(IJeiHelpers jeiHelpers) { + this.jeiHelpers = jeiHelpers; + } + + @Override + public IJeiHelpers getJeiHelpers() { + return jeiHelpers; + } + + @Override + public void addLanguageTransformer(ILanguageTransformer languageTransformer) { + ErrorUtil.checkNotNull(languageTransformer, "languageTransformer"); + + LOGGER.info("Registering language transformer: {}", languageTransformer.getId()); + this.languageTransformers.put(languageTransformer.getId(), languageTransformer); + } + + public Collection getLanguageTransformers() { + return List.copyOf(languageTransformers.values()); + } +} diff --git a/Library/src/main/java/mezz/jei/library/startup/JeiStarter.java b/Library/src/main/java/mezz/jei/library/startup/JeiStarter.java index 63f1ababb..0155e6644 100644 --- a/Library/src/main/java/mezz/jei/library/startup/JeiStarter.java +++ b/Library/src/main/java/mezz/jei/library/startup/JeiStarter.java @@ -10,14 +10,15 @@ import mezz.jei.api.runtime.IIngredientManager; import mezz.jei.api.runtime.IIngredientVisibility; import mezz.jei.api.runtime.IScreenHelper; +import mezz.jei.api.search.ILanguageTransformer; import mezz.jei.common.Internal; import mezz.jei.common.config.DebugConfig; import mezz.jei.common.config.IWorldConfig; +import mezz.jei.common.config.file.ConfigSchemaBuilder; +import mezz.jei.common.config.file.IConfigSchemaBuilder; import mezz.jei.common.platform.Services; import mezz.jei.common.util.ErrorUtil; import mezz.jei.core.util.LoggedTimer; -import mezz.jei.common.config.file.ConfigSchemaBuilder; -import mezz.jei.common.config.file.IConfigSchemaBuilder; import mezz.jei.library.color.ColorHelper; import mezz.jei.library.config.ColorNameConfig; import mezz.jei.library.config.EditModeConfig; @@ -29,6 +30,7 @@ import mezz.jei.library.load.PluginHelper; import mezz.jei.library.load.PluginLoader; import mezz.jei.library.load.registration.RuntimeRegistration; +import mezz.jei.library.load.registration.SearchRegistration; import mezz.jei.library.plugins.jei.JeiInternalPlugin; import mezz.jei.library.plugins.vanilla.VanillaPlugin; import mezz.jei.library.recipes.RecipeManager; @@ -41,6 +43,7 @@ import org.apache.logging.log4j.Logger; import java.nio.file.Path; +import java.util.Collection; import java.util.List; public final class JeiStarter { @@ -118,6 +121,9 @@ public void start() { pluginLoader.createRecipeTransferHandlers(plugins); IRecipeTransferManager recipeTransferManager = new RecipeTransferManager(recipeTransferHandlers); + SearchRegistration searchRegistration = pluginLoader.registerSearch(); + Collection languageTransformers = searchRegistration.getLanguageTransformers(); + LoggedTimer timer = new LoggedTimer(); timer.start("Building runtime"); IScreenHelper screenHelper = pluginLoader.createGuiScreenHelper(plugins, jeiHelpers); @@ -129,7 +135,8 @@ public void start() { ingredientManager, ingredientVisibility, recipeTransferManager, - screenHelper + screenHelper, + languageTransformers ); PluginCaller.callOnPlugins("Registering Runtime", plugins, p -> p.registerRuntime(runtimeRegistration)); diff --git a/gradle.properties b/gradle.properties index 96edc2a8a..8a496e73d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -38,7 +38,7 @@ curseHomepageUrl=https://www.curseforge.com/minecraft/mc-mods/jei jUnitVersion=5.8.2 # Version -specificationVersion=12.1.1 +specificationVersion=12.2.0 # Workaround for Spotless bug # https://github.com/diffplug/spotless/issues/834