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).
Mappings:
Namespace Name
named net/minecraft/recipe/RecipeMatcher
intermediary net/minecraft/class_1662
official cnb
  • Field Details

    • field_30653

      private static final int field_30653
      See Also:
      Mappings:
      Namespace Name Mixin selector
      named field_30653 Lnet/minecraft/recipe/RecipeMatcher;field_30653:I
      intermediary field_30653 Lnet/minecraft/class_1662;field_30653:I
      official b Lcnb;b:I
    • inputs

      public final Int2IntMap inputs
      Mappings:
      Namespace Name Mixin selector
      named inputs Lnet/minecraft/recipe/RecipeMatcher;inputs:Lit/unimi/dsi/fastutil/ints/Int2IntMap;
      intermediary field_7550 Lnet/minecraft/class_1662;field_7550:Lit/unimi/dsi/fastutil/ints/Int2IntMap;
      official a Lcnb;a:Lit/unimi/dsi/fastutil/ints/Int2IntMap;
  • Constructor Details

    • RecipeMatcher

      public RecipeMatcher()
  • Method Details

    • addUnenchantedInput

      public void addUnenchantedInput(ItemStack stack)
      Adds a full item stack to the pool of available resources.

      This is equivalent to calling addInput(stack, Item.DEFAULT_MAX_COUNT).

      Mappings:
      Namespace Name Mixin selector
      named addUnenchantedInput Lnet/minecraft/recipe/RecipeMatcher;addUnenchantedInput(Lnet/minecraft/item/ItemStack;)V
      intermediary method_7404 Lnet/minecraft/class_1662;method_7404(Lnet/minecraft/class_1799;)V
      official a Lcnb;a(Lcuq;)V
    • addInput

      public void addInput(ItemStack stack)
      Adds a full item stack to the pool of available resources.

      This is equivalent to calling addInput(stack, Item.DEFAULT_MAX_COUNT).

      Mappings:
      Namespace Name Mixin selector
      named addInput Lnet/minecraft/recipe/RecipeMatcher;addInput(Lnet/minecraft/item/ItemStack;)V
      intermediary method_7400 Lnet/minecraft/class_1662;method_7400(Lnet/minecraft/class_1799;)V
      official b Lcnb;b(Lcuq;)V
    • addInput

      public void addInput(ItemStack stack, int maxCount)
      Adds an item stack to the pool of available resources.
      Mappings:
      Namespace Name Mixin selector
      named addInput Lnet/minecraft/recipe/RecipeMatcher;addInput(Lnet/minecraft/item/ItemStack;I)V
      intermediary method_20478 Lnet/minecraft/class_1662;method_20478(Lnet/minecraft/class_1799;I)V
      official a Lcnb;a(Lcuq;I)V
    • getItemId

      public static int getItemId(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      named getItemId Lnet/minecraft/recipe/RecipeMatcher;getItemId(Lnet/minecraft/item/ItemStack;)I
      intermediary method_7408 Lnet/minecraft/class_1662;method_7408(Lnet/minecraft/class_1799;)I
      official c Lcnb;c(Lcuq;)I
    • contains

      boolean contains(int itemId)
      Determines whether a raw item id is present in the pool of crafting resources.
      Mappings:
      Namespace Name Mixin selector
      named contains Lnet/minecraft/recipe/RecipeMatcher;contains(I)Z
      intermediary method_7410 Lnet/minecraft/class_1662;method_7410(I)Z
      official b Lcnb;b(I)Z
    • consume

      int consume(int itemId, int count)
      Consumes a resource from the pool of available items.
      Parameters:
      itemId - the raw id of the item being consumed
      count - the number of times that item must be consumed
      Mappings:
      Namespace Name Mixin selector
      named consume Lnet/minecraft/recipe/RecipeMatcher;consume(II)I
      intermediary method_7411 Lnet/minecraft/class_1662;method_7411(II)I
      official a Lcnb;a(II)I
    • addInput

      void addInput(int itemId, int count)
      Adds an input to be used for recipe matching.
      Parameters:
      itemId - the raw ID of the item to match
      count - the item's count
      Mappings:
      Namespace Name Mixin selector
      named addInput Lnet/minecraft/recipe/RecipeMatcher;addInput(II)V
      intermediary method_7401 Lnet/minecraft/class_1662;method_7401(II)V
      official b Lcnb;b(II)V
    • match

      public boolean match(Recipe<?> recipe, @Nullable @Nullable IntList output)
      Attempts to match the recipe against the collected inputs. Assumes only one output is required.
      Parameters:
      recipe - the recipe to match against
      output - optional output list of item ids that were matched whilst evaluating the recipe conditions
      Mappings:
      Namespace Name Mixin selector
      named match Lnet/minecraft/recipe/RecipeMatcher;match(Lnet/minecraft/recipe/Recipe;Lit/unimi/dsi/fastutil/ints/IntList;)Z
      intermediary method_7402 Lnet/minecraft/class_1662;method_7402(Lnet/minecraft/class_1860;Lit/unimi/dsi/fastutil/ints/IntList;)Z
      official a Lcnb;a(Lcyz;Lit/unimi/dsi/fastutil/ints/IntList;)Z
    • match

      public boolean match(Recipe<?> recipe, @Nullable @Nullable IntList output, int multiplier)
      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 against
      output - optional output list of item ids that were matched whilst evaluating the recipe conditions
      multiplier - the number of expected outputs
      Mappings:
      Namespace Name Mixin selector
      named match Lnet/minecraft/recipe/RecipeMatcher;match(Lnet/minecraft/recipe/Recipe;Lit/unimi/dsi/fastutil/ints/IntList;I)Z
      intermediary method_7406 Lnet/minecraft/class_1662;method_7406(Lnet/minecraft/class_1860;Lit/unimi/dsi/fastutil/ints/IntList;I)Z
      official a Lcnb;a(Lcyz;Lit/unimi/dsi/fastutil/ints/IntList;I)Z
    • countCrafts

      public int countCrafts(RecipeEntry<?> recipe, @Nullable @Nullable IntList output)
      Determines the number of crafts that can be produced for a recipe using the collected resources available to this crafter.
      Parameters:
      output - optional output list of item ids that were matched whilst evaluating the recipe conditions
      Mappings:
      Namespace Name Mixin selector
      named countCrafts Lnet/minecraft/recipe/RecipeMatcher;countCrafts(Lnet/minecraft/recipe/RecipeEntry;Lit/unimi/dsi/fastutil/ints/IntList;)I
      intermediary method_7407 Lnet/minecraft/class_1662;method_7407(Lnet/minecraft/class_8786;Lit/unimi/dsi/fastutil/ints/IntList;)I
      official a Lcnb;a(Lczb;Lit/unimi/dsi/fastutil/ints/IntList;)I
    • countCrafts

      public int countCrafts(RecipeEntry<?> recipe, int limit, @Nullable @Nullable IntList output)
      Determines the number of crafts that can be produced for a recipe using the collected resources available to this crafter.
      Parameters:
      output - optional output list of item ids that were matched whilst evaluating the recipe conditions
      Mappings:
      Namespace Name Mixin selector
      named countCrafts Lnet/minecraft/recipe/RecipeMatcher;countCrafts(Lnet/minecraft/recipe/RecipeEntry;ILit/unimi/dsi/fastutil/ints/IntList;)I
      intermediary method_7403 Lnet/minecraft/class_1662;method_7403(Lnet/minecraft/class_8786;ILit/unimi/dsi/fastutil/ints/IntList;)I
      official a Lcnb;a(Lczb;ILit/unimi/dsi/fastutil/ints/IntList;)I
    • getStackFromId

      public static ItemStack getStackFromId(int itemId)
      Mappings:
      Namespace Name Mixin selector
      named getStackFromId Lnet/minecraft/recipe/RecipeMatcher;getStackFromId(I)Lnet/minecraft/item/ItemStack;
      intermediary method_7405 Lnet/minecraft/class_1662;method_7405(I)Lnet/minecraft/class_1799;
      official a Lcnb;a(I)Lcuq;
    • clear

      public void clear()
      Mappings:
      Namespace Name Mixin selector
      named clear Lnet/minecraft/recipe/RecipeMatcher;clear()V
      intermediary method_7409 Lnet/minecraft/class_1662;method_7409()V
      official a Lcnb;a()V