diff options
Diffstat (limited to 'src/main/java/me/shedaniel/rei/impl/SearchArgument.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/impl/SearchArgument.java | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/main/java/me/shedaniel/rei/impl/SearchArgument.java b/src/main/java/me/shedaniel/rei/impl/SearchArgument.java index 17f1545f4..c833e8527 100644 --- a/src/main/java/me/shedaniel/rei/impl/SearchArgument.java +++ b/src/main/java/me/shedaniel/rei/impl/SearchArgument.java @@ -29,26 +29,25 @@ import java.util.function.Function; @Deprecated @Internal public class SearchArgument { - + public static final SearchArgument ALWAYS = new SearchArgument(ArgumentType.ALWAYS, "", true); - @Deprecated - private static List<Item> searchBlacklisted = Lists.newArrayList(); + @Deprecated private static List<Item> searchBlacklisted = Lists.newArrayList(); private ArgumentType argumentType; private String text; public final Function<String, Boolean> INCLUDE = s -> s.contains(text); public final Function<String, Boolean> NOT_INCLUDE = s -> !s.contains(text); private boolean include; - + public SearchArgument(ArgumentType argumentType, String text, boolean include) { this(argumentType, text, include, true); } - + public SearchArgument(ArgumentType argumentType, String text, boolean include, boolean autoLowerCase) { this.argumentType = argumentType; this.text = autoLowerCase ? text.toLowerCase(Locale.ROOT) : text; this.include = include; } - + @Deprecated public static String tryGetEntryStackName(EntryStack stack) { if (stack.getType() == EntryStack.Type.ITEM) @@ -57,7 +56,7 @@ public class SearchArgument { return tryGetFluidName(stack.getFluid()); return ""; } - + @Deprecated public static String tryGetEntryStackTooltip(EntryStack stack) { QueuedTooltip tooltip = stack.getTooltip(0, 0); @@ -65,7 +64,7 @@ public class SearchArgument { return CollectionUtils.joinToString(tooltip.getText(), "\n"); return ""; } - + @Deprecated public static String tryGetFluidName(Fluid fluid) { Identifier id = Registry.FLUID.getId(fluid); @@ -73,7 +72,7 @@ public class SearchArgument { return I18n.translate("block." + id.toString().replaceFirst(":", ".")); return CollectionUtils.mapAndJoinToString(id.getPath().split("_"), StringUtils::capitalize, " "); } - + @Deprecated public static List<String> tryGetItemStackToolTip(ItemStack itemStack, boolean careAboutAdvanced) { if (!searchBlacklisted.contains(itemStack.getItem())) @@ -85,7 +84,7 @@ public class SearchArgument { } return Collections.singletonList(tryGetItemStackName(itemStack)); } - + @Deprecated public static String tryGetItemStackName(ItemStack stack) { if (!searchBlacklisted.contains(stack.getItem())) @@ -102,28 +101,28 @@ public class SearchArgument { } return "ERROR"; } - + public Function<String, Boolean> getFunction(boolean include) { return include ? INCLUDE : NOT_INCLUDE; } - + public ArgumentType getArgumentType() { return argumentType; } - + public String getText() { return text; } - + public boolean isInclude() { return include; } - + @Override public String toString() { return String.format("Argument[%s]: name = %s, include = %b", argumentType.name(), text, include); } - + public enum ArgumentType { TEXT, MOD, @@ -131,20 +130,20 @@ public class SearchArgument { TAG, ALWAYS } - + @Deprecated @Internal public static class SearchArguments { public static final SearchArguments ALWAYS = new SearchArguments(new SearchArgument[]{SearchArgument.ALWAYS}); private SearchArgument[] arguments; - + public SearchArguments(SearchArgument[] arguments) { this.arguments = arguments; } - + public SearchArgument[] getArguments() { return arguments; } } - + } |
