Interface RecipeSerializer<T extends Recipe<?>>

All Known Implementing Classes:
CookingRecipeSerializer, CuttingRecipe.Serializer, LegacySmithingRecipe.Serializer, ShapedRecipe.Serializer, ShapelessRecipe.Serializer, SmithingTransformRecipe.Serializer, SmithingTrimRecipe.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 cja
intermediary net/minecraft/class_1865
named net/minecraft/recipe/RecipeSerializer
  • Field Details

    • SHAPED

      static final RecipeSerializer<ShapedRecipe> SHAPED
      Mappings:
      Namespace Name Mixin selector
      official a Lcja;a:Lcja;
      intermediary field_9035 Lnet/minecraft/class_1865;field_9035:Lnet/minecraft/class_1865;
      named SHAPED Lnet/minecraft/recipe/RecipeSerializer;SHAPED:Lnet/minecraft/recipe/RecipeSerializer;
    • SHAPELESS

      static final RecipeSerializer<ShapelessRecipe> SHAPELESS
      Mappings:
      Namespace Name Mixin selector
      official b Lcja;b:Lcja;
      intermediary field_9031 Lnet/minecraft/class_1865;field_9031:Lnet/minecraft/class_1865;
      named SHAPELESS Lnet/minecraft/recipe/RecipeSerializer;SHAPELESS:Lnet/minecraft/recipe/RecipeSerializer;
    • ARMOR_DYE

      static final RecipeSerializer<ArmorDyeRecipe> ARMOR_DYE
      Mappings:
      Namespace Name Mixin selector
      official c Lcja;c:Lcja;
      intermediary field_9028 Lnet/minecraft/class_1865;field_9028:Lnet/minecraft/class_1865;
      named ARMOR_DYE Lnet/minecraft/recipe/RecipeSerializer;ARMOR_DYE:Lnet/minecraft/recipe/RecipeSerializer;
    • BOOK_CLONING

      static final RecipeSerializer<BookCloningRecipe> BOOK_CLONING
      Mappings:
      Namespace Name Mixin selector
      official d Lcja;d:Lcja;
      intermediary field_9029 Lnet/minecraft/class_1865;field_9029:Lnet/minecraft/class_1865;
      named BOOK_CLONING Lnet/minecraft/recipe/RecipeSerializer;BOOK_CLONING:Lnet/minecraft/recipe/RecipeSerializer;
    • MAP_CLONING

      static final RecipeSerializer<MapCloningRecipe> MAP_CLONING
      Mappings:
      Namespace Name Mixin selector
      official e Lcja;e:Lcja;
      intermediary field_9044 Lnet/minecraft/class_1865;field_9044:Lnet/minecraft/class_1865;
      named MAP_CLONING Lnet/minecraft/recipe/RecipeSerializer;MAP_CLONING:Lnet/minecraft/recipe/RecipeSerializer;
    • MAP_EXTENDING

      static final RecipeSerializer<MapExtendingRecipe> MAP_EXTENDING
      Mappings:
      Namespace Name Mixin selector
      official f Lcja;f:Lcja;
      intermediary field_9039 Lnet/minecraft/class_1865;field_9039:Lnet/minecraft/class_1865;
      named MAP_EXTENDING Lnet/minecraft/recipe/RecipeSerializer;MAP_EXTENDING:Lnet/minecraft/recipe/RecipeSerializer;
    • FIREWORK_ROCKET

      static final RecipeSerializer<FireworkRocketRecipe> FIREWORK_ROCKET
      Mappings:
      Namespace Name Mixin selector
      official g Lcja;g:Lcja;
      intermediary field_9043 Lnet/minecraft/class_1865;field_9043:Lnet/minecraft/class_1865;
      named FIREWORK_ROCKET Lnet/minecraft/recipe/RecipeSerializer;FIREWORK_ROCKET:Lnet/minecraft/recipe/RecipeSerializer;
    • FIREWORK_STAR

      static final RecipeSerializer<FireworkStarRecipe> FIREWORK_STAR
      Mappings:
      Namespace Name Mixin selector
      official h Lcja;h:Lcja;
      intermediary field_9036 Lnet/minecraft/class_1865;field_9036:Lnet/minecraft/class_1865;
      named FIREWORK_STAR Lnet/minecraft/recipe/RecipeSerializer;FIREWORK_STAR:Lnet/minecraft/recipe/RecipeSerializer;
    • FIREWORK_STAR_FADE

      static final RecipeSerializer<FireworkStarFadeRecipe> FIREWORK_STAR_FADE
      Mappings:
      Namespace Name Mixin selector
      official i Lcja;i:Lcja;
      intermediary field_9034 Lnet/minecraft/class_1865;field_9034:Lnet/minecraft/class_1865;
      named FIREWORK_STAR_FADE Lnet/minecraft/recipe/RecipeSerializer;FIREWORK_STAR_FADE:Lnet/minecraft/recipe/RecipeSerializer;
    • TIPPED_ARROW

      static final RecipeSerializer<TippedArrowRecipe> TIPPED_ARROW
      Mappings:
      Namespace Name Mixin selector
      official j Lcja;j:Lcja;
      intermediary field_9037 Lnet/minecraft/class_1865;field_9037:Lnet/minecraft/class_1865;
      named TIPPED_ARROW Lnet/minecraft/recipe/RecipeSerializer;TIPPED_ARROW:Lnet/minecraft/recipe/RecipeSerializer;
    • SHIELD_DECORATION

      static final RecipeSerializer<ShieldDecorationRecipe> SHIELD_DECORATION
      Mappings:
      Namespace Name Mixin selector
      official l Lcja;l:Lcja;
      intermediary field_9040 Lnet/minecraft/class_1865;field_9040:Lnet/minecraft/class_1865;
      named SHIELD_DECORATION Lnet/minecraft/recipe/RecipeSerializer;SHIELD_DECORATION:Lnet/minecraft/recipe/RecipeSerializer;
    • SHULKER_BOX

      static final RecipeSerializer<ShulkerBoxColoringRecipe> SHULKER_BOX
      Mappings:
      Namespace Name Mixin selector
      official m Lcja;m:Lcja;
      intermediary field_9041 Lnet/minecraft/class_1865;field_9041:Lnet/minecraft/class_1865;
      named SHULKER_BOX Lnet/minecraft/recipe/RecipeSerializer;SHULKER_BOX:Lnet/minecraft/recipe/RecipeSerializer;
    • SUSPICIOUS_STEW

      static final RecipeSerializer<SuspiciousStewRecipe> SUSPICIOUS_STEW
      Mappings:
      Namespace Name Mixin selector
      official n Lcja;n:Lcja;
      intermediary field_9030 Lnet/minecraft/class_1865;field_9030:Lnet/minecraft/class_1865;
      named SUSPICIOUS_STEW Lnet/minecraft/recipe/RecipeSerializer;SUSPICIOUS_STEW:Lnet/minecraft/recipe/RecipeSerializer;
    • REPAIR_ITEM

      static final RecipeSerializer<RepairItemRecipe> REPAIR_ITEM
      Mappings:
      Namespace Name Mixin selector
      official o Lcja;o:Lcja;
      intermediary field_19421 Lnet/minecraft/class_1865;field_19421:Lnet/minecraft/class_1865;
      named REPAIR_ITEM Lnet/minecraft/recipe/RecipeSerializer;REPAIR_ITEM:Lnet/minecraft/recipe/RecipeSerializer;
    • SMELTING

      static final RecipeSerializer<SmeltingRecipe> SMELTING
      Mappings:
      Namespace Name Mixin selector
      official p Lcja;p:Lcja;
      intermediary field_9042 Lnet/minecraft/class_1865;field_9042:Lnet/minecraft/class_1865;
      named SMELTING Lnet/minecraft/recipe/RecipeSerializer;SMELTING:Lnet/minecraft/recipe/RecipeSerializer;
    • BLASTING

      static final RecipeSerializer<BlastingRecipe> BLASTING
      Mappings:
      Namespace Name Mixin selector
      official q Lcja;q:Lcja;
      intermediary field_17084 Lnet/minecraft/class_1865;field_17084:Lnet/minecraft/class_1865;
      named BLASTING Lnet/minecraft/recipe/RecipeSerializer;BLASTING:Lnet/minecraft/recipe/RecipeSerializer;
    • SMOKING

      static final RecipeSerializer<SmokingRecipe> SMOKING
      Mappings:
      Namespace Name Mixin selector
      official r Lcja;r:Lcja;
      intermediary field_17085 Lnet/minecraft/class_1865;field_17085:Lnet/minecraft/class_1865;
      named SMOKING Lnet/minecraft/recipe/RecipeSerializer;SMOKING:Lnet/minecraft/recipe/RecipeSerializer;
    • CAMPFIRE_COOKING

      static final RecipeSerializer<CampfireCookingRecipe> CAMPFIRE_COOKING
      Mappings:
      Namespace Name Mixin selector
      official s Lcja;s:Lcja;
      intermediary field_17347 Lnet/minecraft/class_1865;field_17347:Lnet/minecraft/class_1865;
      named CAMPFIRE_COOKING Lnet/minecraft/recipe/RecipeSerializer;CAMPFIRE_COOKING:Lnet/minecraft/recipe/RecipeSerializer;
    • STONECUTTING

      static final RecipeSerializer<StonecuttingRecipe> STONECUTTING
      Mappings:
      Namespace Name Mixin selector
      official t Lcja;t:Lcja;
      intermediary field_17640 Lnet/minecraft/class_1865;field_17640:Lnet/minecraft/class_1865;
      named STONECUTTING Lnet/minecraft/recipe/RecipeSerializer;STONECUTTING:Lnet/minecraft/recipe/RecipeSerializer;
    • SMITHING

      static final RecipeSerializer<LegacySmithingRecipe> SMITHING
      Mappings:
      Namespace Name Mixin selector
      official u Lcja;u:Lcja;
      intermediary field_25387 Lnet/minecraft/class_1865;field_25387:Lnet/minecraft/class_1865;
      named SMITHING Lnet/minecraft/recipe/RecipeSerializer;SMITHING:Lnet/minecraft/recipe/RecipeSerializer;
    • SMITHING_TRANSFORM

      static final RecipeSerializer<SmithingTransformRecipe> SMITHING_TRANSFORM
      Mappings:
      Namespace Name Mixin selector
      official v Lcja;v:Lcja;
      intermediary field_42027 Lnet/minecraft/class_1865;field_42027:Lnet/minecraft/class_1865;
      named SMITHING_TRANSFORM Lnet/minecraft/recipe/RecipeSerializer;SMITHING_TRANSFORM:Lnet/minecraft/recipe/RecipeSerializer;
    • SMITHING_TRIM

      static final RecipeSerializer<SmithingTrimRecipe> SMITHING_TRIM
      Mappings:
      Namespace Name Mixin selector
      official w Lcja;w:Lcja;
      intermediary field_42028 Lnet/minecraft/class_1865;field_42028:Lnet/minecraft/class_1865;
      named SMITHING_TRIM Lnet/minecraft/recipe/RecipeSerializer;SMITHING_TRIM:Lnet/minecraft/recipe/RecipeSerializer;
    • CRAFTING_DECORATED_POT

      static final RecipeSerializer<CraftingDecoratedPotRecipe> CRAFTING_DECORATED_POT
      Mappings:
      Namespace Name Mixin selector
      official x Lcja;x:Lcja;
      intermediary field_42718 Lnet/minecraft/class_1865;field_42718:Lnet/minecraft/class_1865;
      named CRAFTING_DECORATED_POT Lnet/minecraft/recipe/RecipeSerializer;CRAFTING_DECORATED_POT:Lnet/minecraft/recipe/RecipeSerializer;
  • Method Details

    • read

      T read(Identifier id, JsonObject json)
      Reads a recipe from a JSON object.
      Parameters:
      id - the recipe's ID
      json - the recipe JSON
      Returns:
      the read recipe
      Throws:
      JsonParseException - if the recipe JSON is incorrect
      Implementation Note:
      If this throws any exception besides JsonParseException and IllegalArgumentException, it will terminate and affect loading of all recipes from data packs beyond the current recipe.
      Mappings:
      Namespace Name Mixin selector
      official b Lcja;b(Ladd;Lcom/google/gson/JsonObject;)Lciy;
      intermediary method_8121 Lnet/minecraft/class_1865;method_8121(Lnet/minecraft/class_2960;Lcom/google/gson/JsonObject;)Lnet/minecraft/class_1860;
      named read Lnet/minecraft/recipe/RecipeSerializer;read(Lnet/minecraft/util/Identifier;Lcom/google/gson/JsonObject;)Lnet/minecraft/recipe/Recipe;
    • read

      T read(Identifier id, PacketByteBuf buf)
      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 ID
      buf - the recipe buf
      Returns:
      the read recipe
      Mappings:
      Namespace Name Mixin selector
      official b Lcja;b(Ladd;Lss;)Lciy;
      intermediary method_8122 Lnet/minecraft/class_1865;method_8122(Lnet/minecraft/class_2960;Lnet/minecraft/class_2540;)Lnet/minecraft/class_1860;
      named read Lnet/minecraft/recipe/RecipeSerializer;read(Lnet/minecraft/util/Identifier;Lnet/minecraft/network/PacketByteBuf;)Lnet/minecraft/recipe/Recipe;
    • write

      void write(PacketByteBuf buf, T recipe)
      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 buf
      recipe - the recipe
      Mappings:
      Namespace Name Mixin selector
      official a Lcja;a(Lss;Lciy;)V
      intermediary method_8124 Lnet/minecraft/class_1865;method_8124(Lnet/minecraft/class_2540;Lnet/minecraft/class_1860;)V
      named write Lnet/minecraft/recipe/RecipeSerializer;write(Lnet/minecraft/network/PacketByteBuf;Lnet/minecraft/recipe/Recipe;)V
    • register

      static <S extends RecipeSerializer<T>, T extends Recipe<?>> S register(String id, S serializer)
      Mappings:
      Namespace Name Mixin selector
      official a Lcja;a(Ljava/lang/String;Lcja;)Lcja;
      intermediary method_17724 Lnet/minecraft/class_1865;method_17724(Ljava/lang/String;Lnet/minecraft/class_1865;)Lnet/minecraft/class_1865;
      named register Lnet/minecraft/recipe/RecipeSerializer;register(Ljava/lang/String;Lnet/minecraft/recipe/RecipeSerializer;)Lnet/minecraft/recipe/RecipeSerializer;