Interface Recipe<C extends Inventory>
- All Known Subinterfaces:
- CraftingRecipe,- SmithingRecipe
- All Known Implementing Classes:
- AbstractCookingRecipe,- ArmorDyeRecipe,- BannerDuplicateRecipe,- BlastingRecipe,- BookCloningRecipe,- CampfireCookingRecipe,- CraftingDecoratedPotRecipe,- CuttingRecipe,- FireworkRocketRecipe,- FireworkStarFadeRecipe,- FireworkStarRecipe,- MapCloningRecipe,- MapExtendingRecipe,- RepairItemRecipe,- ShapedRecipe,- ShapelessRecipe,- ShieldDecorationRecipe,- ShulkerBoxColoringRecipe,- SmeltingRecipe,- SmithingTransformRecipe,- SmithingTrimRecipe,- SmokingRecipe,- SpecialCraftingRecipe,- StonecuttingRecipe,- SuspiciousStewRecipe,- TippedArrowRecipe
Recipes are loaded by and stored in the RecipeManager. They
 are part of the server's data packs and are sent to the client, governed
 by their serializers. Hence, recipes
 should not be stored, as they may become obsolete after reloads.
 
A few of the methods in this class are dedicated to crafting recipes or recipe books. Users can have stub implementations if they do not use those functionalities.
- Mappings:
- Namespace - Name - official - cjc- intermediary - net/minecraft/class_1860- named - net/minecraft/recipe/Recipe
- 
Method SummaryModifier and TypeMethodDescriptioncraft(C inventory, DynamicRegistryManager registryManager) Crafts this recipe.default ItemStackReturns an item rendered on the top left of the output preview on the recipe toast when a new recipe is unlocked.booleanfits(int width, int height) Returns whether this recipe will fit into the given grid size.default StringgetGroup()Returns a group this recipe belongs in, or an empty string.getId()Returns the ID of this recipe.default DefaultedList<Ingredient>Returns the ingredients accepted as inputs for this recipe.getOutput(DynamicRegistryManager registryManager) Returns a preview of the recipe's output.default DefaultedList<ItemStack>getRemainder(C inventory) Returns the remaining stacks to be left in theinventoryafter the recipe is used.Returns the serializer associated with this recipe.RecipeType<?>getType()Returns the type of this recipe.default booleanisEmpty()Returns whether this recipe has no ingredient or has any empty ingredient.default booleanReturns whether this recipe is ignored by the recipe book.booleanReturns whether this recipe matches the contents inside theinventoryin the givenworld.default boolean
- 
Method Details- 
matchesReturns whether this recipe matches the contents inside theinventoryin the givenworld.The worldcurrently is only used by the map cloning recipe to prevent duplication of explorer maps.- Parameters:
- inventory- the input inventory
- world- the input world
- Returns:
- whether this recipe matches the contents inside the
 inventoryin the givenworld
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lcjc;a(Lbdq;Lcmm;)Z- intermediary - method_8115- Lnet/minecraft/class_1860;method_8115(Lnet/minecraft/class_1263;Lnet/minecraft/class_1937;)Z- named - matches- Lnet/minecraft/recipe/Recipe;matches(Lnet/minecraft/inventory/Inventory;Lnet/minecraft/world/World;)Z
 
- 
craftCrafts this recipe.This method does not perform side effects on the inventory.This method should return a new item stack on each call. - Parameters:
- inventory- the input inventory
- Returns:
- the resulting item stack
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lcjc;a(Lbdq;Lhs;)Lcfz;- intermediary - method_8116- Lnet/minecraft/class_1860;method_8116(Lnet/minecraft/class_1263;Lnet/minecraft/class_5455;)Lnet/minecraft/class_1799;- named - craft- Lnet/minecraft/recipe/Recipe;craft(Lnet/minecraft/inventory/Inventory;Lnet/minecraft/registry/DynamicRegistryManager;)Lnet/minecraft/item/ItemStack;
 
- 
fitsboolean fits(int width, int height) Returns whether this recipe will fit into the given grid size.This is currently only used by recipe book. - Parameters:
- width- the width of the input inventory
- height- the height of the input inventory
- Returns:
- whether this recipe will fit into the given grid size
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lcjc;a(II)Z- intermediary - method_8113- Lnet/minecraft/class_1860;method_8113(II)Z- named - fits- Lnet/minecraft/recipe/Recipe;fits(II)Z
 
- 
getOutputReturns a preview of the recipe's output.The returned stack should not be modified. To obtain the actual output, call craft(Inventory, DynamicRegistryManager).- Returns:
- a preview of the recipe's output
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lcjc;a(Lhs;)Lcfz;- intermediary - method_8110- Lnet/minecraft/class_1860;method_8110(Lnet/minecraft/class_5455;)Lnet/minecraft/class_1799;- named - getOutput- Lnet/minecraft/recipe/Recipe;getOutput(Lnet/minecraft/registry/DynamicRegistryManager;)Lnet/minecraft/item/ItemStack;
 
- 
getRemainderReturns the remaining stacks to be left in theinventoryafter the recipe is used. At each index, the remainder item stack in the list should correspond to the original item stack in theinventory.- Parameters:
- inventory- the input inventory
- Returns:
- the remaining stacks to be left in the inventoryafter the recipe is used
- Implementation Requirements:
- The default implementation returns a list of the same size as the inventory. At each index, the list contains the remainder of the item stack at the same index in theinventory, or is empty if the stack has no remainder.
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lcjc;a(Lbdq;)Lhn;- intermediary - method_8111- Lnet/minecraft/class_1860;method_8111(Lnet/minecraft/class_1263;)Lnet/minecraft/class_2371;- named - getRemainder- Lnet/minecraft/recipe/Recipe;getRemainder(Lnet/minecraft/inventory/Inventory;)Lnet/minecraft/util/collection/DefaultedList;
 
- 
getIngredientsReturns the ingredients accepted as inputs for this recipe. Used by the recipe book when displaying a ghost form of this recipe on the crafting grid as well as for previewing the possible inputs in the book itself.- Returns:
- the ingredients accepted as inputs for this recipe
- Mappings:
- Namespace - Name - Mixin selector - official - a- Lcjc;a()Lhn;- intermediary - method_8117- Lnet/minecraft/class_1860;method_8117()Lnet/minecraft/class_2371;- named - getIngredients- Lnet/minecraft/recipe/Recipe;getIngredients()Lnet/minecraft/util/collection/DefaultedList;
 
- 
isIgnoredInRecipeBookdefault boolean isIgnoredInRecipeBook()Returns whether this recipe is ignored by the recipe book. If a recipe is ignored by the recipe book, it will be never displayed. In addition, it won't be restricted by thedoLimitedCraftinggame rule.- Returns:
- whether this recipe is ignored by the recipe book
- Mappings:
- Namespace - Name - Mixin selector - official - ai_- Lcjc;ai_()Z- intermediary - method_8118- Lnet/minecraft/class_1860;method_8118()Z- named - isIgnoredInRecipeBook- Lnet/minecraft/recipe/Recipe;isIgnoredInRecipeBook()Z
 
- 
showNotificationdefault boolean showNotification()- Mappings:
- Namespace - Name - Mixin selector - official - i- Lcjc;i()Z- intermediary - method_49188- Lnet/minecraft/class_1860;method_49188()Z- named - showNotification- Lnet/minecraft/recipe/Recipe;showNotification()Z
 
- 
getGroupReturns a group this recipe belongs in, or an empty string. This is only used by the recipe book.The group string is arbitrary, and is not rendered anywhere; in the recipe book, recipes with the same group will belong to the same cell in the grid of recipes. If the string is empty, this recipe will belong to its own cell. - Returns:
- a group this recipe belongs in, or an empty string
- Mappings:
- Namespace - Name - Mixin selector - official - c- Lcjc;c()Ljava/lang/String;- intermediary - method_8112- Lnet/minecraft/class_1860;method_8112()Ljava/lang/String;- named - getGroup- Lnet/minecraft/recipe/Recipe;getGroup()Ljava/lang/String;
 
- 
createIconReturns an item rendered on the top left of the output preview on the recipe toast when a new recipe is unlocked. This can be interpreted as a catalyst for the recipe.- Returns:
- an item rendered on the top left of the output preview on the recipe toast when a new recipe is unlocked
- Mappings:
- Namespace - Name - Mixin selector - official - h- Lcjc;h()Lcfz;- intermediary - method_17447- Lnet/minecraft/class_1860;method_17447()Lnet/minecraft/class_1799;- named - createIcon- Lnet/minecraft/recipe/Recipe;createIcon()Lnet/minecraft/item/ItemStack;
 
- 
getIdIdentifier getId()Returns the ID of this recipe.- Returns:
- the ID of this recipe
- Mappings:
- Namespace - Name - Mixin selector - official - e- Lcjc;e()Lacq;- intermediary - method_8114- Lnet/minecraft/class_1860;method_8114()Lnet/minecraft/class_2960;- named - getId- Lnet/minecraft/recipe/Recipe;getId()Lnet/minecraft/util/Identifier;
 
- 
getSerializerRecipeSerializer<?> getSerializer()Returns the serializer associated with this recipe.- Returns:
- the serializer associated with this recipe
- Mappings:
- Namespace - Name - Mixin selector - official - aj_- Lcjc;aj_()Lcje;- intermediary - method_8119- Lnet/minecraft/class_1860;method_8119()Lnet/minecraft/class_1865;- named - getSerializer- Lnet/minecraft/recipe/Recipe;getSerializer()Lnet/minecraft/recipe/RecipeSerializer;
 
- 
getTypeRecipeType<?> getType()Returns the type of this recipe.The typein the recipe JSON format is the serializer instead.- Returns:
- the type of this recipe
- Mappings:
- Namespace - Name - Mixin selector - official - f- Lcjc;f()Lcjf;- intermediary - method_17716- Lnet/minecraft/class_1860;method_17716()Lnet/minecraft/class_3956;- named - getType- Lnet/minecraft/recipe/Recipe;getType()Lnet/minecraft/recipe/RecipeType;
 
- 
isEmptydefault boolean isEmpty()Returns whether this recipe has no ingredient or has any empty ingredient. The recipe book uses this to ignore recipes for display.- Returns:
- whether this recipe has no ingredient or has any empty ingredient
- Mappings:
- Namespace - Name - Mixin selector - official - j- Lcjc;j()Z- intermediary - method_31584- Lnet/minecraft/class_1860;method_31584()Z- named - isEmpty- Lnet/minecraft/recipe/Recipe;isEmpty()Z
 
 
-