Interface RecipeRegistry
public interface RecipeRegistry
Where recipes are declared: the vanilla ones the server loads at startup, and the ones plugins
add.
When a grid matches several recipes, the ones registered by plugins win over the vanilla ones, in the order they were registered. To replace a vanilla recipe outright, unregister it first.
Implementations are thread-safe.
- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleanmatchCrafting(CraftingInput input) Finds the recipe a crafting grid makes, the way a crafting table does.recipes()voidDeclares a recipe.tags()booleanunregister(Key key) Drops a recipe, a vanilla one included.voidunregisterAll(Object owner) Drops every recipe a plugin declared.
-
Method Details
-
register
Declares a recipe.- Parameters:
recipe- the recipeowner- the plugin declaring it, so that it can be dropped with the others when the plugin is disabled- Throws:
IllegalArgumentException- if a recipe is already registered underRecipe.key()- Since:
- 0.1.0
-
unregister
Drops a recipe, a vanilla one included.- Parameters:
key- the identifier of the recipe- Returns:
trueif a recipe was registered under that key- Since:
- 0.1.0
-
unregisterAll
Drops every recipe a plugin declared.- Parameters:
owner- the plugin to clean up after- Since:
- 0.1.0
-
recipe
-
recipes
Collection<Recipe> recipes()- Returns:
- every registered recipe, plugin ones first, in matching order
- Since:
- 0.1.0
-
isVanilla
- Parameters:
key- the identifier of the recipe- Returns:
truewhen that recipe comes from the vanilla data rather than a plugin- Since:
- 0.1.0
-
matchCrafting
Finds the recipe a crafting grid makes, the way a crafting table does.- Parameters:
input- the grid- Returns:
- the first matching recipe, with what it gives and takes; empty when none matches
- Since:
- 0.1.0
-
tags
ItemTagLookup tags()- Returns:
- the item tags the server resolves tag ingredients with
- Since:
- 0.1.0
-