Package net.minecraft.recipe
Interface RecipeSerializer<T extends Recipe<?>>
- All Known Implementing Classes:
CookingRecipeSerializer,CuttingRecipe.Serializer,ShapedRecipe.Serializer,ShapelessRecipe.Serializer,SmithingRecipe.Serializer,SpecialRecipeSerializer
public interface RecipeSerializer<T extends Recipe<?>>
The recipe serializer controls the serialization and deserialization of
recipe content. The caller should handle the serialization of recipes' IDs.
Even though they are referred to by the type field in recipe
JSON format, they are stored in a registry with key
minecraft:root/minecraft:recipe_serializer, and is hence named.
If a recipe's serializer exists only on the server but not on the client, the client will disconnect upon receiving the recipe; if a recipe JSON intended for an absent recipe serializer is read, it is skipped.
- Mappings:
Namespace Name official ccuintermediary net/minecraft/class_1865named net/minecraft/recipe/RecipeSerializer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SpecialRecipeSerializer<ArmorDyeRecipe>static final SpecialRecipeSerializer<BannerDuplicateRecipe>static final CookingRecipeSerializer<BlastingRecipe>static final SpecialRecipeSerializer<BookCloningRecipe>static final CookingRecipeSerializer<CampfireCookingRecipe>static final SpecialRecipeSerializer<FireworkRocketRecipe>static final SpecialRecipeSerializer<FireworkStarRecipe>static final SpecialRecipeSerializer<FireworkStarFadeRecipe>static final SpecialRecipeSerializer<MapCloningRecipe>static final SpecialRecipeSerializer<MapExtendingRecipe>static final SpecialRecipeSerializer<RepairItemRecipe>static final RecipeSerializer<ShapedRecipe>static final RecipeSerializer<ShapelessRecipe>static final SpecialRecipeSerializer<ShieldDecorationRecipe>static final SpecialRecipeSerializer<ShulkerBoxColoringRecipe>static final CookingRecipeSerializer<SmeltingRecipe>static final RecipeSerializer<SmithingRecipe>static final CookingRecipeSerializer<SmokingRecipe>static final RecipeSerializer<StonecuttingRecipe>static final SpecialRecipeSerializer<SuspiciousStewRecipe>static final SpecialRecipeSerializer<TippedArrowRecipe> -
Method Summary
Modifier and TypeMethodDescriptionread(Identifier id, JsonObject json) Reads a recipe from a JSON object.read(Identifier id, PacketByteBuf buf) Reads a recipe from a packet byte buf, usually on the client.static <S extends RecipeSerializer<T>,T extends Recipe<?>>
Svoidwrite(PacketByteBuf buf, T recipe) Writes a recipe to a packet byte buf, usually on the server.
-
Field Details
-
SHAPED
- Mappings:
Namespace Name Mixin selector official aLccu;a:Lccu;intermediary field_9035Lnet/minecraft/class_1865;field_9035:Lnet/minecraft/class_1865;named SHAPEDLnet/minecraft/recipe/RecipeSerializer;SHAPED:Lnet/minecraft/recipe/RecipeSerializer;
-
SHAPELESS
- Mappings:
Namespace Name Mixin selector official bLccu;b:Lccu;intermediary field_9031Lnet/minecraft/class_1865;field_9031:Lnet/minecraft/class_1865;named SHAPELESSLnet/minecraft/recipe/RecipeSerializer;SHAPELESS:Lnet/minecraft/recipe/RecipeSerializer;
-
ARMOR_DYE
- Mappings:
Namespace Name Mixin selector official cLccu;c:Lcdc;intermediary field_9028Lnet/minecraft/class_1865;field_9028:Lnet/minecraft/class_1866;named ARMOR_DYELnet/minecraft/recipe/RecipeSerializer;ARMOR_DYE:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
BOOK_CLONING
- Mappings:
Namespace Name Mixin selector official dLccu;d:Lcdc;intermediary field_9029Lnet/minecraft/class_1865;field_9029:Lnet/minecraft/class_1866;named BOOK_CLONINGLnet/minecraft/recipe/RecipeSerializer;BOOK_CLONING:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
MAP_CLONING
- Mappings:
Namespace Name Mixin selector official eLccu;e:Lcdc;intermediary field_9044Lnet/minecraft/class_1865;field_9044:Lnet/minecraft/class_1866;named MAP_CLONINGLnet/minecraft/recipe/RecipeSerializer;MAP_CLONING:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
MAP_EXTENDING
- Mappings:
Namespace Name Mixin selector official fLccu;f:Lcdc;intermediary field_9039Lnet/minecraft/class_1865;field_9039:Lnet/minecraft/class_1866;named MAP_EXTENDINGLnet/minecraft/recipe/RecipeSerializer;MAP_EXTENDING:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
FIREWORK_ROCKET
- Mappings:
Namespace Name Mixin selector official gLccu;g:Lcdc;intermediary field_9043Lnet/minecraft/class_1865;field_9043:Lnet/minecraft/class_1866;named FIREWORK_ROCKETLnet/minecraft/recipe/RecipeSerializer;FIREWORK_ROCKET:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
FIREWORK_STAR
- Mappings:
Namespace Name Mixin selector official hLccu;h:Lcdc;intermediary field_9036Lnet/minecraft/class_1865;field_9036:Lnet/minecraft/class_1866;named FIREWORK_STARLnet/minecraft/recipe/RecipeSerializer;FIREWORK_STAR:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
FIREWORK_STAR_FADE
- Mappings:
Namespace Name Mixin selector official iLccu;i:Lcdc;intermediary field_9034Lnet/minecraft/class_1865;field_9034:Lnet/minecraft/class_1866;named FIREWORK_STAR_FADELnet/minecraft/recipe/RecipeSerializer;FIREWORK_STAR_FADE:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
TIPPED_ARROW
- Mappings:
Namespace Name Mixin selector official jLccu;j:Lcdc;intermediary field_9037Lnet/minecraft/class_1865;field_9037:Lnet/minecraft/class_1866;named TIPPED_ARROWLnet/minecraft/recipe/RecipeSerializer;TIPPED_ARROW:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
BANNER_DUPLICATE
- Mappings:
Namespace Name Mixin selector official kLccu;k:Lcdc;intermediary field_9038Lnet/minecraft/class_1865;field_9038:Lnet/minecraft/class_1866;named BANNER_DUPLICATELnet/minecraft/recipe/RecipeSerializer;BANNER_DUPLICATE:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
SHIELD_DECORATION
- Mappings:
Namespace Name Mixin selector official lLccu;l:Lcdc;intermediary field_9040Lnet/minecraft/class_1865;field_9040:Lnet/minecraft/class_1866;named SHIELD_DECORATIONLnet/minecraft/recipe/RecipeSerializer;SHIELD_DECORATION:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
SHULKER_BOX
- Mappings:
Namespace Name Mixin selector official mLccu;m:Lcdc;intermediary field_9041Lnet/minecraft/class_1865;field_9041:Lnet/minecraft/class_1866;named SHULKER_BOXLnet/minecraft/recipe/RecipeSerializer;SHULKER_BOX:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
SUSPICIOUS_STEW
- Mappings:
Namespace Name Mixin selector official nLccu;n:Lcdc;intermediary field_9030Lnet/minecraft/class_1865;field_9030:Lnet/minecraft/class_1866;named SUSPICIOUS_STEWLnet/minecraft/recipe/RecipeSerializer;SUSPICIOUS_STEW:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
REPAIR_ITEM
- Mappings:
Namespace Name Mixin selector official oLccu;o:Lcdc;intermediary field_19421Lnet/minecraft/class_1865;field_19421:Lnet/minecraft/class_1866;named REPAIR_ITEMLnet/minecraft/recipe/RecipeSerializer;REPAIR_ITEM:Lnet/minecraft/recipe/SpecialRecipeSerializer;
-
SMELTING
- Mappings:
Namespace Name Mixin selector official pLccu;p:Lcdb;intermediary field_9042Lnet/minecraft/class_1865;field_9042:Lnet/minecraft/class_3957;named SMELTINGLnet/minecraft/recipe/RecipeSerializer;SMELTING:Lnet/minecraft/recipe/CookingRecipeSerializer;
-
BLASTING
- Mappings:
Namespace Name Mixin selector official qLccu;q:Lcdb;intermediary field_17084Lnet/minecraft/class_1865;field_17084:Lnet/minecraft/class_3957;named BLASTINGLnet/minecraft/recipe/RecipeSerializer;BLASTING:Lnet/minecraft/recipe/CookingRecipeSerializer;
-
SMOKING
- Mappings:
Namespace Name Mixin selector official rLccu;r:Lcdb;intermediary field_17085Lnet/minecraft/class_1865;field_17085:Lnet/minecraft/class_3957;named SMOKINGLnet/minecraft/recipe/RecipeSerializer;SMOKING:Lnet/minecraft/recipe/CookingRecipeSerializer;
-
CAMPFIRE_COOKING
- Mappings:
Namespace Name Mixin selector official sLccu;s:Lcdb;intermediary field_17347Lnet/minecraft/class_1865;field_17347:Lnet/minecraft/class_3957;named CAMPFIRE_COOKINGLnet/minecraft/recipe/RecipeSerializer;CAMPFIRE_COOKING:Lnet/minecraft/recipe/CookingRecipeSerializer;
-
STONECUTTING
- Mappings:
Namespace Name Mixin selector official tLccu;t:Lccu;intermediary field_17640Lnet/minecraft/class_1865;field_17640:Lnet/minecraft/class_1865;named STONECUTTINGLnet/minecraft/recipe/RecipeSerializer;STONECUTTING:Lnet/minecraft/recipe/RecipeSerializer;
-
SMITHING
- Mappings:
Namespace Name Mixin selector official uLccu;u:Lccu;intermediary field_25387Lnet/minecraft/class_1865;field_25387:Lnet/minecraft/class_1865;named SMITHINGLnet/minecraft/recipe/RecipeSerializer;SMITHING:Lnet/minecraft/recipe/RecipeSerializer;
-
-
Method Details
-
read
Reads a recipe from a JSON object.- Parameters:
id- the recipe's IDjson- the recipe JSON- Returns:
- the read recipe
- Throws:
JsonParseException- if the recipe JSON is incorrect- Implementation Note:
- If this throws any exception besides
JsonParseExceptionandIllegalArgumentException, it will terminate and affect loading of all recipes from data packs beyond the current recipe. - Mappings:
Namespace Name Mixin selector official aLccu;a(Laaj;Lcom/google/gson/JsonObject;)Lccs;intermediary method_8121Lnet/minecraft/class_1865;method_8121(Lnet/minecraft/class_2960;Lcom/google/gson/JsonObject;)Lnet/minecraft/class_1860;named readLnet/minecraft/recipe/RecipeSerializer;read(Lnet/minecraft/util/Identifier;Lcom/google/gson/JsonObject;)Lnet/minecraft/recipe/Recipe;
-
read
Reads a recipe from a packet byte buf, usually on the client.This can throw whatever exception the packet byte buf throws. This may be called in the netty event loop than the client game engine thread.
- Parameters:
id- the recipe's IDbuf- the recipe buf- Returns:
- the read recipe
- Mappings:
Namespace Name Mixin selector official aLccu;a(Laaj;Lqx;)Lccs;intermediary method_8122Lnet/minecraft/class_1865;method_8122(Lnet/minecraft/class_2960;Lnet/minecraft/class_2540;)Lnet/minecraft/class_1860;named readLnet/minecraft/recipe/RecipeSerializer;read(Lnet/minecraft/util/Identifier;Lnet/minecraft/network/PacketByteBuf;)Lnet/minecraft/recipe/Recipe;
-
write
Writes a recipe to a packet byte buf, usually on the server.The recipe's ID is already written into the buf when this is called.
This can throw whatever exception the packet byte buf throws. This may be called in the netty event loop than the server game engine thread.
- Parameters:
buf- the recipe bufrecipe- the recipe- Mappings:
Namespace Name Mixin selector official aLccu;a(Lqx;Lccs;)Vintermediary method_8124Lnet/minecraft/class_1865;method_8124(Lnet/minecraft/class_2540;Lnet/minecraft/class_1860;)Vnamed writeLnet/minecraft/recipe/RecipeSerializer;write(Lnet/minecraft/network/PacketByteBuf;Lnet/minecraft/recipe/Recipe;)V
-
register
- Mappings:
Namespace Name Mixin selector official aLccu;a(Ljava/lang/String;Lccu;)Lccu;intermediary method_17724Lnet/minecraft/class_1865;method_17724(Ljava/lang/String;Lnet/minecraft/class_1865;)Lnet/minecraft/class_1865;named registerLnet/minecraft/recipe/RecipeSerializer;register(Ljava/lang/String;Lnet/minecraft/recipe/RecipeSerializer;)Lnet/minecraft/recipe/RecipeSerializer;
-