Object PartialSearch
-
- All Implemented Interfaces:
public class PartialSearchProvides partial recipe match search functionality.
A partial match occurs when the player's current crafting grid satisfies some — but not necessarily all — of a recipe's required slots. This is useful for recipe hints, crafting guides, and autocomplete suggestions.
Both CRecipe.Type.SHAPED and CRecipe.Type.SHAPELESS recipe types are supported. Recipes that implement io.github.sakaki_aruka.customcrafter.recipe.UnPartialSearchableRecipe are excluded from all partial searches.
- Since:
5.0.21
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumPartialSearch.MatchStateRepresents the degree to which a recipe's slots are satisfied by the current input.
public interfacePartialSearch.PartialSearchResultThe common interface for a single partial-search result entry.
Each instance represents one candidate recipe together with the match information derived from comparing the current CraftView against that recipe.
public final classPartialSearch.PartialShapedResultPartial-search result for a CRecipe.Type.SHAPED recipe.
public final classPartialSearch.PartialShapelessResultPartial-search result for a CRecipe.Type.SHAPELESS recipe.
Because shapeless recipes have no positional constraint, a recipe slot may be satisfiable by more than one input slot. relations captures these weak (non-exclusive) candidate associations; the true MatchState is determined by computing a maximum bipartite matching over relations in state.
-
Field Summary
Fields Modifier and Type Field Description public final static PartialSearchINSTANCE
-
Method Summary
Modifier and Type Method Description final static CompletableFuture<List<PartialSearch.PartialSearchResult>>asyncPartialSearch(UUID crafterId, CraftView view, Search.SearchQuery searchQuery, List<CRecipe> sourceRecipes, Explainer explainer)Runs a partial recipe search asynchronously and returns a future that resolves to all PartialSearchResult entries whose recipes are at least partially satisfied by the items currently placed in the crafting grid. final static CompletableFuture<List<PartialSearch.PartialSearchResult>>asyncPartialSearch(UUID crafterId, CraftView view, Search.SearchQuery searchQuery, List<CRecipe> sourceRecipes)Runs a partial recipe search asynchronously and returns a future that resolves to all PartialSearchResult entries whose recipes are at least partially satisfied by the items currently placed in the crafting grid. final static CompletableFuture<List<PartialSearch.PartialSearchResult>>asyncPartialSearch(UUID crafterId, CraftView view, Search.SearchQuery searchQuery)Runs a partial recipe search asynchronously and returns a future that resolves to all PartialSearchResult entries whose recipes are at least partially satisfied by the items currently placed in the crafting grid. final static CompletableFuture<List<PartialSearch.PartialSearchResult>>asyncPartialSearch(UUID crafterId, CraftView view)Runs a partial recipe search asynchronously and returns a future that resolves to all PartialSearchResult entries whose recipes are at least partially satisfied by the items currently placed in the crafting grid. -
-
Method Detail
-
asyncPartialSearch
@JvmOverloads() final static CompletableFuture<List<PartialSearch.PartialSearchResult>> asyncPartialSearch(UUID crafterId, CraftView view, Search.SearchQuery searchQuery, List<CRecipe> sourceRecipes, Explainer explainer)
Runs a partial recipe search asynchronously and returns a future that resolves to all PartialSearchResult entries whose recipes are at least partially satisfied by the items currently placed in the crafting grid.
Recipes that implement io.github.sakaki_aruka.customcrafter.recipe.UnPartialSearchableRecipe and recipes whose minimum required slot count exceeds the number of items in view are excluded before any per-recipe work is dispatched.
The behaviour of searchQuery fields:
Search.SearchQuery.searchMode — when Search.SearchQuery.SearchMode.ONLY_FIRST, the future completes as soon as the first non-empty per-recipe result is available and the remaining tasks are cancelled.
Search.SearchQuery.asyncContext — propagated to per-recipe evaluations so that predicate execution and interruption signals are handled consistently.
vanillaSearchMode— not applicable; partial search is custom-recipe only.
- Parameters:
crafterId- UUID of the player whose crafting grid is being evaluated.view- Snapshot of the crafting grid to match against.searchQuery- Controls search behaviour such as result mode and async context.sourceRecipes- The pool of recipes to search.explainer- Logs container instance (since 5.3.- Returns:
A CompletableFuture that resolves to the list of partial-search results. The list is empty when no recipe even partially matches the current input.
- Since:
5.0.21
-
asyncPartialSearch
@JvmOverloads() final static CompletableFuture<List<PartialSearch.PartialSearchResult>> asyncPartialSearch(UUID crafterId, CraftView view, Search.SearchQuery searchQuery, List<CRecipe> sourceRecipes)
Runs a partial recipe search asynchronously and returns a future that resolves to all PartialSearchResult entries whose recipes are at least partially satisfied by the items currently placed in the crafting grid.
Recipes that implement io.github.sakaki_aruka.customcrafter.recipe.UnPartialSearchableRecipe and recipes whose minimum required slot count exceeds the number of items in view are excluded before any per-recipe work is dispatched.
The behaviour of searchQuery fields:
Search.SearchQuery.searchMode — when Search.SearchQuery.SearchMode.ONLY_FIRST, the future completes as soon as the first non-empty per-recipe result is available and the remaining tasks are cancelled.
Search.SearchQuery.asyncContext — propagated to per-recipe evaluations so that predicate execution and interruption signals are handled consistently.
vanillaSearchMode— not applicable; partial search is custom-recipe only.
- Parameters:
crafterId- UUID of the player whose crafting grid is being evaluated.view- Snapshot of the crafting grid to match against.searchQuery- Controls search behaviour such as result mode and async context.sourceRecipes- The pool of recipes to search.- Returns:
A CompletableFuture that resolves to the list of partial-search results. The list is empty when no recipe even partially matches the current input.
- Since:
5.0.21
-
asyncPartialSearch
@JvmOverloads() final static CompletableFuture<List<PartialSearch.PartialSearchResult>> asyncPartialSearch(UUID crafterId, CraftView view, Search.SearchQuery searchQuery)
Runs a partial recipe search asynchronously and returns a future that resolves to all PartialSearchResult entries whose recipes are at least partially satisfied by the items currently placed in the crafting grid.
Recipes that implement io.github.sakaki_aruka.customcrafter.recipe.UnPartialSearchableRecipe and recipes whose minimum required slot count exceeds the number of items in view are excluded before any per-recipe work is dispatched.
The behaviour of searchQuery fields:
Search.SearchQuery.searchMode — when Search.SearchQuery.SearchMode.ONLY_FIRST, the future completes as soon as the first non-empty per-recipe result is available and the remaining tasks are cancelled.
Search.SearchQuery.asyncContext — propagated to per-recipe evaluations so that predicate execution and interruption signals are handled consistently.
vanillaSearchMode— not applicable; partial search is custom-recipe only.
- Parameters:
crafterId- UUID of the player whose crafting grid is being evaluated.view- Snapshot of the crafting grid to match against.searchQuery- Controls search behaviour such as result mode and async context.- Returns:
A CompletableFuture that resolves to the list of partial-search results. The list is empty when no recipe even partially matches the current input.
- Since:
5.0.21
-
asyncPartialSearch
@JvmOverloads() final static CompletableFuture<List<PartialSearch.PartialSearchResult>> asyncPartialSearch(UUID crafterId, CraftView view)
Runs a partial recipe search asynchronously and returns a future that resolves to all PartialSearchResult entries whose recipes are at least partially satisfied by the items currently placed in the crafting grid.
Recipes that implement io.github.sakaki_aruka.customcrafter.recipe.UnPartialSearchableRecipe and recipes whose minimum required slot count exceeds the number of items in view are excluded before any per-recipe work is dispatched.
The behaviour of searchQuery fields:
Search.SearchQuery.searchMode — when Search.SearchQuery.SearchMode.ONLY_FIRST, the future completes as soon as the first non-empty per-recipe result is available and the remaining tasks are cancelled.
Search.SearchQuery.asyncContext — propagated to per-recipe evaluations so that predicate execution and interruption signals are handled consistently.
vanillaSearchMode— not applicable; partial search is custom-recipe only.
- Parameters:
crafterId- UUID of the player whose crafting grid is being evaluated.view- Snapshot of the crafting grid to match against.- Returns:
A CompletableFuture that resolves to the list of partial-search results. The list is empty when no recipe even partially matches the current input.
- Since:
5.0.21
-
-
-
-