Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
Updating methods
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkKronicle committed Apr 11, 2022
1 parent 20849e8 commit efed3fd
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import lombok.Getter;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.text.Text;

/** An object that holds information about a search. */
@Environment(EnvType.CLIENT)
Expand Down Expand Up @@ -126,4 +127,18 @@ public static SearchResult searchOf(String input, String match, FindType type) {
List<StringMatch> matches = finder.getMatches(input, match);
return new SearchResult(input, match, finder, matches);
}

/**
* A method to construct a SearchResult based off of an input, condition, and {@link FindType}
*
* @param input Input string to match from
* @param match Search text
* @param type {@link FindType} way to search
* @return SearchResult with compiled searches
*/
public static SearchResult searchOf(Text input, String match, FindType type) {
IFinder finder = type.getFinder();
List<StringMatch> matches = finder.getMatches(input, match);
return new SearchResult(input.getString(), match, finder, matches);
}
}

0 comments on commit efed3fd

Please sign in to comment.