Compare commits

..
Author SHA1 Message Date
slprime 685477b381 fix type 2024-06-13 08:38:53 +03:00
slprime 28d653a3b5 add matching language to searh parser 2024-06-13 08:25:33 +03:00
Martin Robertz 34734a622b Merge branch 'master' into jei_search 2024-06-11 20:19:43 +02:00
slprime 331a9fd638 code refactoring 2024-06-11 00:15:24 +03:00
slprime 98c49caff9 move autofocus config to seatch widget panel 2024-06-10 23:56:43 +03:00
Martin Robertz 622b696389 Merge branch 'master' into jei_search 2024-06-10 22:22:29 +02:00
slprime 985e1e0425 add regexp to extended patternMode 2024-06-08 20:21:10 +03:00
slprime da05482ef0 fix unicode case in search 2024-05-31 10:30:40 +03:00
slprime b41c570315 fix search crash without prefixes 2024-05-31 07:44:40 +03:00
slprime 0373e7376b fix extended search pattern 2024-05-30 20:16:35 +03:00
slprime 178021a8e8 add subfilter 2024-05-30 19:24:20 +03:00
slprime 8dd9014109 Create JEI like Search 2024-05-29 19:50:29 +03:00
10 changed files with 18 additions and 36 deletions

No files matched your search

+2 -1
View File
@@ -1,6 +1,7 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:CodeChickenCore:1.3.0:dev')
api('com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev')
api('com.github.GTNewHorizons:CodeChickenCore:1.2.1:dev')
shadowImplementation('org.apache.commons:commons-csv:1.10.0')
}
+2 -2
View File
@@ -141,7 +141,7 @@ modrinthProjectId = notenoughitems-unofficial
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations = required-project\:codechickencore-unofficial
modrinthRelations = required-project\:codechickenlib-unofficial;required-project\:codechickencore-unofficial
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
@@ -155,7 +155,7 @@ curseForgeProjectId = 358228
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
curseForgeRelations = requiredDependency\:codechickencore-unofficial
curseForgeRelations = requiredDependency\:codechickencore-unofficial;requiredDependency\:codechickenlib-unofficial
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# projects. New projects should not use this parameter.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+1 -1
View File
@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
}
@@ -235,7 +235,7 @@ public class SearchField extends TextField implements ItemFilterProvider {
}
public static String getEscapedSearchText(ItemStack stack) {
final FluidStack fluidStack = StackInfo.isFluidContainer(stack) ? null : StackInfo.getFluid(stack);
final FluidStack fluidStack = StackInfo.getFluid(stack);
String displayName;
if (fluidStack != null) {
@@ -65,17 +65,12 @@ public class SearchTokenParser {
private static class ProvidersCache {
public String languageCode = null;
public List<ISearchParserProvider> providers = new ArrayList<>();
public void clear() {
this.languageCode = null;
this.providers.clear();
}
protected String languageCode = null;
protected List<ISearchParserProvider> providers;
}
protected final List<ISearchParserProvider> searchProviders;
protected final ProvidersCache providersCache = new ProvidersCache();
protected ProvidersCache providersCache = new ProvidersCache();
public SearchTokenParser(List<ISearchParserProvider> searchProviders) {
this.searchProviders = searchProviders;
@@ -87,7 +82,6 @@ public class SearchTokenParser {
public void addProvider(ISearchParserProvider provider) {
this.searchProviders.add(provider);
this.providersCache.clear();
}
protected List<ISearchParserProvider> getProviders() {
@@ -99,7 +93,7 @@ public class SearchTokenParser {
for (int index = this.searchProviders.size() - 1; index >= 0; index--) {
ISearchParserProvider provider = this.searchProviders.get(index);
if (!providers.containsKey(provider.getPrefix())
if (!providers.containsKey(provider.getPrefix()) && provider.getSearchMode() != SearchMode.NEVER
&& provider.getMatchingLanguages().contains(currentLanguage)) {
providers.put(provider.getPrefix(), provider);
}
@@ -113,9 +107,7 @@ public class SearchTokenParser {
}
public ISearchParserProvider getProvider(char ch) {
return getProviders().stream()
.filter(provider -> provider.getSearchMode() == SearchMode.PREFIX && provider.getPrefix() == ch)
.findFirst().orElse(null);
return getProviders().stream().filter(provider -> provider.getPrefix() == ch).findFirst().orElse(null);
}
public ItemFilter getFilter(String filterText) {
@@ -197,7 +197,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
return ingredients;
}
public void randomRenderPermutation(List<PositionedStack> stacks, long cycle) {
protected void randomRenderPermutation(List<PositionedStack> stacks, long cycle) {
final ItemFilter filter = getItemFilter();
final int randCycle = Math.abs(new Random(cycle + offset).nextInt());
@@ -228,7 +228,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
}
@Deprecated
public void randomRenderPermutation(PositionedStack stack, long cycle) {
protected void randomRenderPermutation(PositionedStack stack, long cycle) {
Random rand = new Random(cycle + offset);
stack.setPermutationToRender((int) (Math.abs(rand.nextInt()) % stack.items.length));
}
@@ -8,8 +8,6 @@ import net.minecraft.item.ItemStack;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.api.ItemFilter;
import codechicken.nei.api.ItemInfo;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
@@ -23,16 +21,7 @@ public class ModNameFilter implements ItemFilter {
@Override
public boolean matches(ItemStack itemStack) {
return this.pattern.matcher(nameFromStack(itemStack.getItem())).find();
}
protected static String nameFromStack(Item item) {
try {
ModContainer mod = Loader.instance().getIndexedModList().get(getModId(item));
return mod == null ? "Minecraft" : mod.getName();
} catch (NullPointerException e) {
return "";
}
return this.pattern.matcher(getModId(itemStack.getItem())).find();
}
protected static String getModId(Item item) {
@@ -54,7 +54,7 @@ public class TooltipFilter implements ItemFilter {
@Override
public boolean matches(ItemStack itemStack) {
return pattern.matcher(getSearchTooltip(itemStack)).find();
return pattern.matcher(getSearchName(itemStack)).find();
}
public static void populateSearchMap() {
@@ -68,7 +68,7 @@ public class TooltipFilter implements ItemFilter {
itemSearchNames.keySet().removeAll(oldItems);
}
protected static String getSearchTooltip(ItemStack stack) {
protected static String getSearchName(ItemStack stack) {
return itemSearchNames.computeIfAbsent(new ItemStackKey(stack), key -> getTooltip(key.stack));
}