Interface Recipe<T extends RecipeInput>
- 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,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 named net/minecraft/recipe/Recipeintermediary net/minecraft/class_1860official czt
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Recipe<?>> static final PacketCodec<RegistryByteBuf, Recipe<?>> -
Method Summary
Modifier and TypeMethodDescriptioncraft(T input, RegistryWrapper.WrapperLookup lookup) 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.default DefaultedList<ItemStack> getRemainder(T input) Returns the remaining stacks to be left in theinventoryafter the recipe is used.getResult(RegistryWrapper.WrapperLookup registriesLookup) Returns a preview of the recipe's output.Returns the serializer associated with this recipe.RecipeType<?> getType()Returns the type of this recipe.default booleanReturns whether this recipe is ignored by the recipe book.booleanReturns whether this recipe matches the contents inside theinventoryin the givenworld.default boolean
-
Field Details
-
CODEC
- Mappings:
Namespace Name Mixin selector named CODECLnet/minecraft/recipe/Recipe;CODEC:Lcom/mojang/serialization/Codec;intermediary field_47319Lnet/minecraft/class_1860;field_47319:Lcom/mojang/serialization/Codec;official hLczt;h:Lcom/mojang/serialization/Codec;
-
PACKET_CODEC
- Mappings:
Namespace Name Mixin selector named PACKET_CODECLnet/minecraft/recipe/Recipe;PACKET_CODEC:Lnet/minecraft/network/codec/PacketCodec;intermediary field_48356Lnet/minecraft/class_1860;field_48356:Lnet/minecraft/class_9139;official iLczt;i:Lzb;
-
-
Method Details
-
matches
Returns 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:
world- the input world- Returns:
- whether this recipe matches the contents inside the
inventoryin the givenworld - Mappings:
Namespace Name Mixin selector named matchesLnet/minecraft/recipe/Recipe;matches(Lnet/minecraft/recipe/input/RecipeInput;Lnet/minecraft/world/World;)Zintermediary method_8115Lnet/minecraft/class_1860;method_8115(Lnet/minecraft/class_9695;Lnet/minecraft/class_1937;)Zofficial aLczt;a(Lczw;Ldds;)Z
-
craft
Crafts this recipe.This method does not perform side effects on the
inventory.This method should return a new item stack on each call.
- Returns:
- the resulting item stack
- Mappings:
Namespace Name Mixin selector named craftLnet/minecraft/recipe/Recipe;craft(Lnet/minecraft/recipe/input/RecipeInput;Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)Lnet/minecraft/item/ItemStack;intermediary method_8116Lnet/minecraft/class_1860;method_8116(Lnet/minecraft/class_9695;Lnet/minecraft/class_7225$class_7874;)Lnet/minecraft/class_1799;official aLczt;a(Lczw;Ljp$a;)Lcvl;
-
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 named fitsLnet/minecraft/recipe/Recipe;fits(II)Zintermediary method_8113Lnet/minecraft/class_1860;method_8113(II)Zofficial aLczt;a(II)Z
-
getResult
Returns 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 named getResultLnet/minecraft/recipe/Recipe;getResult(Lnet/minecraft/registry/RegistryWrapper$WrapperLookup;)Lnet/minecraft/item/ItemStack;intermediary method_8110Lnet/minecraft/class_1860;method_8110(Lnet/minecraft/class_7225$class_7874;)Lnet/minecraft/class_1799;official aLczt;a(Ljp$a;)Lcvl;
-
getRemainder
Returns 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.- 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 named getRemainderLnet/minecraft/recipe/Recipe;getRemainder(Lnet/minecraft/recipe/input/RecipeInput;)Lnet/minecraft/util/collection/DefaultedList;intermediary method_8111Lnet/minecraft/class_1860;method_8111(Lnet/minecraft/class_9695;)Lnet/minecraft/class_2371;official aLczt;a(Lczw;)Ljw;
-
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 named isIgnoredInRecipeBookLnet/minecraft/recipe/Recipe;isIgnoredInRecipeBook()Zintermediary method_8118Lnet/minecraft/class_1860;method_8118()Zofficial ar_Lczt;ar_()Z
-
showNotification
default boolean showNotification()- Mappings:
Namespace Name Mixin selector named showNotificationLnet/minecraft/recipe/Recipe;showNotification()Zintermediary method_49188Lnet/minecraft/class_1860;method_49188()Zofficial hLczt;h()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 named getGroupLnet/minecraft/recipe/Recipe;getGroup()Ljava/lang/String;intermediary method_8112Lnet/minecraft/class_1860;method_8112()Ljava/lang/String;official cLczt;c()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 named createIconLnet/minecraft/recipe/Recipe;createIcon()Lnet/minecraft/item/ItemStack;intermediary method_17447Lnet/minecraft/class_1860;method_17447()Lnet/minecraft/class_1799;official gLczt;g()Lcvl;
-
getSerializer
RecipeSerializer<?> getSerializer()Returns the serializer associated with this recipe.- Returns:
- the serializer associated with this recipe
- Mappings:
Namespace Name Mixin selector named getSerializerLnet/minecraft/recipe/Recipe;getSerializer()Lnet/minecraft/recipe/RecipeSerializer;intermediary method_8119Lnet/minecraft/class_1860;method_8119()Lnet/minecraft/class_1865;official as_Lczt;as_()Lczy;
-
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 named getTypeLnet/minecraft/recipe/Recipe;getType()Lnet/minecraft/recipe/RecipeType;intermediary method_17716Lnet/minecraft/class_1860;method_17716()Lnet/minecraft/class_3956;official eLczt;e()Lczz;
-
method_61671
class_9887 method_61671()- Mappings:
Namespace Name Mixin selector named method_61671Lnet/minecraft/recipe/Recipe;method_61671()Lnet/minecraft/class_9887;intermediary method_61671Lnet/minecraft/class_1860;method_61671()Lnet/minecraft/class_9887;official aLczt;a()Lczs;
-