Package net.minecraft.recipe
Class RecipeMatcher
java.lang.Object
net.minecraft.recipe.RecipeMatcher
public class RecipeMatcher extends Object
Matching class that matches a recipe to its required resources.
This specifically does not check patterns (See
ShapedRecipe for that).-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classRecipeMatcher.Filter -
Field Summary
Fields Modifier and Type Field Description Int2IntMapinputs -
Constructor Summary
Constructors Constructor Description RecipeMatcher() -
Method Summary
Modifier and Type Method Description private voidaddInput(int itemId, int count)Adds an input to be used for recipe matching.voidaddInput(ItemStack stack)Adds a full item stack to the pool of available resources.voidaddUnenchantedInput(ItemStack stack)Adds a full item stack to the pool of available resources.voidclear()private intconsume(int itemId, int count)Consumes a resource from the pool of available items.private booleancontains(int itemId)Determines whether a raw item id is present in the pool of crafting resources.intcountCrafts(Recipe<?> recipe, int limit, IntList output)Determines the number of crafts that can be produced for a recipe using the collected resources available to this crafter.intcountCrafts(Recipe<?> recipe, IntList output)Determines the number of crafts that can be produced for a recipe using the collected resources available to this crafter.static intgetItemId(ItemStack stack)static ItemStackgetStackFromId(int itemId)booleanmatch(Recipe<?> recipe, IntList output)Attempts to match the recipe against the collected inputs.booleanmatch(Recipe<?> recipe, IntList output, int multiplier)Attempts to match the recipe against the collected inputs.voidmethod_20478(ItemStack itemStack, int int2)
-
Field Details
-
inputs
-
-
Constructor Details
-
RecipeMatcher
public RecipeMatcher()
-
-
Method Details
-
addUnenchantedInput
Adds a full item stack to the pool of available resources.This is equivalent to calling
addInput(stack, Item.DEFAULT_MAX_COUNT). -
addInput
Adds a full item stack to the pool of available resources.This is equivalent to calling
addInput(stack, Item.DEFAULT_MAX_COUNT). -
method_20478
-
getItemId
-
contains
private boolean contains(int itemId)Determines whether a raw item id is present in the pool of crafting resources. -
consume
private int consume(int itemId, int count)Consumes a resource from the pool of available items.- Parameters:
itemId- the raw id of the item being consumedcount- the number of times that item must be consumed
-
addInput
private void addInput(int itemId, int count)Adds an input to be used for recipe matching.- Parameters:
itemId- the raw ID of the item to matchcount- the item's count
-
match
Attempts to match the recipe against the collected inputs. Assumes only one output is required.- Parameters:
recipe- the recipe to match againstoutput- optional output list of item ids that were matched whilst evaluating the recipe conditions
-
match
Attempts to match the recipe against the collected inputs. Will only succeed if there has been enough resources gathered to produce the requested number of outputs.- Parameters:
recipe- the recipe to match againstoutput- optional output list of item ids that were matched whilst evaluating the recipe conditionsmultiplier- the number of expected outputs
-
countCrafts
Determines the number of crafts that can be produced for a recipe using the collected resources available to this crafter.- Parameters:
recipe- the recipe to match againstoutput- optional output list of item ids that were matched whilst evaluating the recipe conditions
-
countCrafts
Determines the number of crafts that can be produced for a recipe using the collected resources available to this crafter.- Parameters:
recipe- the recipe to match againstoutput- optional output list of item ids that were matched whilst evaluating the recipe conditions
-
getStackFromId
-
clear
public void clear()
-