Compare commits

...
8 changed files with 33 additions and 14 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-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/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/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.22'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.23'
}
@@ -235,7 +235,7 @@ public class SearchField extends TextField implements ItemFilterProvider {
}
public static String getEscapedSearchText(ItemStack stack) {
final FluidStack fluidStack = StackInfo.getFluid(stack);
final FluidStack fluidStack = StackInfo.isFluidContainer(stack) ? null : StackInfo.getFluid(stack);
String displayName;
if (fluidStack != null) {
@@ -65,12 +65,17 @@ public class SearchTokenParser {
private static class ProvidersCache {
protected String languageCode = null;
protected List<ISearchParserProvider> providers;
public String languageCode = null;
public List<ISearchParserProvider> providers = new ArrayList<>();
public void clear() {
this.languageCode = null;
this.providers.clear();
}
}
protected final List<ISearchParserProvider> searchProviders;
protected ProvidersCache providersCache = new ProvidersCache();
protected final ProvidersCache providersCache = new ProvidersCache();
public SearchTokenParser(List<ISearchParserProvider> searchProviders) {
this.searchProviders = searchProviders;
@@ -82,6 +87,7 @@ public class SearchTokenParser {
public void addProvider(ISearchParserProvider provider) {
this.searchProviders.add(provider);
this.providersCache.clear();
}
protected List<ISearchParserProvider> getProviders() {
@@ -93,7 +99,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()) && provider.getSearchMode() != SearchMode.NEVER
if (!providers.containsKey(provider.getPrefix())
&& provider.getMatchingLanguages().contains(currentLanguage)) {
providers.put(provider.getPrefix(), provider);
}
@@ -107,7 +113,9 @@ public class SearchTokenParser {
}
public ISearchParserProvider getProvider(char ch) {
return getProviders().stream().filter(provider -> provider.getPrefix() == ch).findFirst().orElse(null);
return getProviders().stream()
.filter(provider -> provider.getSearchMode() == SearchMode.PREFIX && provider.getPrefix() == ch)
.findFirst().orElse(null);
}
public ItemFilter getFilter(String filterText) {
@@ -197,7 +197,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
return ingredients;
}
protected void randomRenderPermutation(List<PositionedStack> stacks, long cycle) {
public 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
protected void randomRenderPermutation(PositionedStack stack, long cycle) {
public void randomRenderPermutation(PositionedStack stack, long cycle) {
Random rand = new Random(cycle + offset);
stack.setPermutationToRender((int) (Math.abs(rand.nextInt()) % stack.items.length));
}
@@ -8,6 +8,8 @@ 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;
@@ -21,7 +23,16 @@ public class ModNameFilter implements ItemFilter {
@Override
public boolean matches(ItemStack itemStack) {
return this.pattern.matcher(getModId(itemStack.getItem())).find();
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 "";
}
}
protected static String getModId(Item item) {
@@ -54,7 +54,7 @@ public class TooltipFilter implements ItemFilter {
@Override
public boolean matches(ItemStack itemStack) {
return pattern.matcher(getSearchName(itemStack)).find();
return pattern.matcher(getSearchTooltip(itemStack)).find();
}
public static void populateSearchMap() {
@@ -68,7 +68,7 @@ public class TooltipFilter implements ItemFilter {
itemSearchNames.keySet().removeAll(oldItems);
}
protected static String getSearchName(ItemStack stack) {
protected static String getSearchTooltip(ItemStack stack) {
return itemSearchNames.computeIfAbsent(new ItemStackKey(stack), key -> getTooltip(key.stack));
}