Interface Recipe<C extends Inventory>
- All Known Subinterfaces:
CraftingRecipe
- All Known Implementing Classes:
AbstractCookingRecipe,ArmorDyeRecipe,BannerDuplicateRecipe,BlastingRecipe,BookCloningRecipe,CampfireCookingRecipe,CuttingRecipe,FireworkRocketRecipe,FireworkStarFadeRecipe,FireworkStarRecipe,MapCloningRecipe,MapExtendingRecipe,RepairItemRecipe,ShapedRecipe,ShapelessRecipe,ShieldDecorationRecipe,ShulkerBoxColoringRecipe,SmeltingRecipe,SmithingRecipe,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 cfrintermediary net/minecraft/class_1860named net/minecraft/recipe/Recipe
-
Method Summary
Modifier and TypeMethodDescriptiondefault 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.Returns a preview of the recipe's output.default DefaultedList<ItemStack>getRemainder(C inventory) 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.boolean
-
Method Details
-
matches
- Parameters:
inventory- the input inventoryworld- the input world- Mappings:
Namespace Name Mixin selector official aLcfr;a(Lbbn;Lciz;)Zintermediary method_8115Lnet/minecraft/class_1860;method_8115(Lnet/minecraft/class_1263;Lnet/minecraft/class_1937;)Znamed matchesLnet/minecraft/recipe/Recipe;matches(Lnet/minecraft/inventory/Inventory;Lnet/minecraft/world/World;)Z
-
craft
- Parameters:
inventory- the input inventory- Mappings:
Namespace Name Mixin selector official aLcfr;a(Lbbn;)Lccw;intermediary method_8116Lnet/minecraft/class_1860;method_8116(Lnet/minecraft/class_1263;)Lnet/minecraft/class_1799;named craftLnet/minecraft/recipe/Recipe;craft(Lnet/minecraft/inventory/Inventory;)Lnet/minecraft/item/ItemStack;
-
fits
boolean 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 inventoryheight- the height of the input inventory- Returns:
- whether this recipe will fit into the given grid size
- Mappings:
Namespace Name Mixin selector official aLcfr;a(II)Zintermediary method_8113Lnet/minecraft/class_1860;method_8113(II)Znamed fitsLnet/minecraft/recipe/Recipe;fits(II)Z
-
getOutput
ItemStack getOutput()Returns a preview of the recipe's output.The returned stack should not be modified. To obtain the actual output, call
craft(Inventory).- Returns:
- a preview of the recipe's output
- Mappings:
Namespace Name Mixin selector official cLcfr;c()Lccw;intermediary method_8110Lnet/minecraft/class_1860;method_8110()Lnet/minecraft/class_1799;named getOutputLnet/minecraft/recipe/Recipe;getOutput()Lnet/minecraft/item/ItemStack;
-
getRemainder
- Parameters:
inventory- the input inventory- Mappings:
Namespace Name Mixin selector official bLcfr;b(Lbbn;)Lhh;intermediary method_8111Lnet/minecraft/class_1860;method_8111(Lnet/minecraft/class_1263;)Lnet/minecraft/class_2371;named getRemainderLnet/minecraft/recipe/Recipe;getRemainder(Lnet/minecraft/inventory/Inventory;)Lnet/minecraft/util/collection/DefaultedList;
-
getIngredients
Returns 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 aLcfr;a()Lhh;intermediary method_8117Lnet/minecraft/class_1860;method_8117()Lnet/minecraft/class_2371;named getIngredientsLnet/minecraft/recipe/Recipe;getIngredients()Lnet/minecraft/util/collection/DefaultedList;
-
isIgnoredInRecipeBook
default 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 V_Lcfr;V_()Zintermediary method_8118Lnet/minecraft/class_1860;method_8118()Znamed isIgnoredInRecipeBookLnet/minecraft/recipe/Recipe;isIgnoredInRecipeBook()Z
-
getGroup
Returns 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 dLcfr;d()Ljava/lang/String;intermediary method_8112Lnet/minecraft/class_1860;method_8112()Ljava/lang/String;named getGroupLnet/minecraft/recipe/Recipe;getGroup()Ljava/lang/String;
-
createIcon
Returns 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 iLcfr;i()Lccw;intermediary method_17447Lnet/minecraft/class_1860;method_17447()Lnet/minecraft/class_1799;named createIconLnet/minecraft/recipe/Recipe;createIcon()Lnet/minecraft/item/ItemStack;
-
getId
Identifier getId()Returns the ID of this recipe.- Returns:
- the ID of this recipe
- Mappings:
Namespace Name Mixin selector official fLcfr;f()Labv;intermediary method_8114Lnet/minecraft/class_1860;method_8114()Lnet/minecraft/class_2960;named getIdLnet/minecraft/recipe/Recipe;getId()Lnet/minecraft/util/Identifier;
-
getSerializer
RecipeSerializer<?> getSerializer()Returns the serializer associated with this recipe.- Returns:
- the serializer associated with this recipe
- Mappings:
Namespace Name Mixin selector official W_Lcfr;W_()Lcft;intermediary method_8119Lnet/minecraft/class_1860;method_8119()Lnet/minecraft/class_1865;named getSerializerLnet/minecraft/recipe/Recipe;getSerializer()Lnet/minecraft/recipe/RecipeSerializer;
-
getType
RecipeType<?> 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 gLcfr;g()Lcfu;intermediary method_17716Lnet/minecraft/class_1860;method_17716()Lnet/minecraft/class_3956;named getTypeLnet/minecraft/recipe/Recipe;getType()Lnet/minecraft/recipe/RecipeType;
-
isEmpty
default 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 jLcfr;j()Zintermediary method_31584Lnet/minecraft/class_1860;method_31584()Znamed isEmptyLnet/minecraft/recipe/Recipe;isEmpty()Z
-