Class ConditionalRecipe.Serializer<T extends Recipe<?>>

java.lang.Object
net.minecraftforge.common.crafting.ConditionalRecipe.Serializer<T>
All Implemented Interfaces:
RecipeSerializer<T>, IForgeRecipeSerializer<T>, IForgeRegistryEntry<RecipeSerializer<?>>
Enclosing class:
ConditionalRecipe

public static class ConditionalRecipe.Serializer<T extends Recipe<?>> extends Object implements RecipeSerializer<T>
  • Field Details

  • Constructor Details

    • Serializer

      public Serializer()
  • Method Details

    • setRegistryName

      public RecipeSerializer<?> setRegistryName(ResourceLocation name)
      Description copied from interface: IForgeRegistryEntry
      Sets a unique name for this Item. This should be used for uniquely identify the instance of the Item. This is the valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does. Unlocalized names have NOTHING to do with unique identifiers. As demonstrated by vanilla blocks and items. The supplied name will be prefixed with the currently active mod's modId. If the supplied name already has a prefix that is different, it will be used and a warning will be logged. If a name already exists, or this Item is already registered in a registry, then an IllegalStateException is thrown. Returns 'this' to allow for chaining.
      Specified by:
      setRegistryName in interface IForgeRegistryEntry<T extends Recipe<?>>
      Parameters:
      name - Unique registry name
      Returns:
      This instance
    • getRegistryName

      public ResourceLocation getRegistryName()
      Description copied from interface: IForgeRegistryEntry
      A unique identifier for this entry, if this entry is registered already it will return it's official registry name. Otherwise it will return the name set in setRegistryName(). If neither are valid null is returned.
      Specified by:
      getRegistryName in interface IForgeRegistryEntry<T extends Recipe<?>>
      Returns:
      Unique identifier or null.
    • getRegistryType

      public Class<RecipeSerializer<?>> getRegistryType()
      Description copied from interface: IForgeRegistryEntry
      Determines the type for this entry, used to look up the correct registry in the global registries list as there can only be one registry per concrete class.
      Specified by:
      getRegistryType in interface IForgeRegistryEntry<T extends Recipe<?>>
      Returns:
      Root registry type.
    • castClass

      private static <G> Class<G> castClass(Class<?> cls)
    • fromJson

      public T fromJson(ResourceLocation recipeId, com.google.gson.JsonObject json)
      Specified by:
      fromJson in interface RecipeSerializer<T extends Recipe<?>>
    • fromJson

      public T fromJson(ResourceLocation recipeId, com.google.gson.JsonObject json, ICondition.IContext context)
      Specified by:
      fromJson in interface IForgeRecipeSerializer<T extends Recipe<?>>
    • fromNetwork

      public T fromNetwork(ResourceLocation recipeId, FriendlyByteBuf buffer)
      Specified by:
      fromNetwork in interface RecipeSerializer<T extends Recipe<?>>
    • toNetwork

      public void toNetwork(FriendlyByteBuf buffer, T recipe)
      Specified by:
      toNetwork in interface RecipeSerializer<T extends Recipe<?>>