Class GenericSerializer<T extends SerializableRecipe>

java.lang.Object
com.hrznstudio.titanium.recipe.serializer.GenericSerializer<T>
Type Parameters:
T -
All Implemented Interfaces:
IRecipeSerializerReversed<T>, net.minecraft.world.item.crafting.RecipeSerializer<T>, net.minecraftforge.common.extensions.IForgeRecipeSerializer<T>

public class GenericSerializer<T extends SerializableRecipe> extends Object implements net.minecraft.world.item.crafting.RecipeSerializer<T>, IRecipeSerializerReversed<T>
Generic recipe serializer, that will serialize a recipe from the Handlers in @JSONSerializableDataHandler. All fields in the @SerializableRecipe must be public to be used properly.
  • Field Summary

    Fields inherited from interface net.minecraft.world.item.crafting.RecipeSerializer

    ARMOR_DYE, BANNER_DUPLICATE, BLASTING_RECIPE, BOOK_CLONING, CAMPFIRE_COOKING_RECIPE, DECORATED_POT_RECIPE, FIREWORK_ROCKET, FIREWORK_STAR, FIREWORK_STAR_FADE, MAP_CLONING, MAP_EXTENDING, REPAIR_ITEM, SHAPED_RECIPE, SHAPELESS_RECIPE, SHIELD_DECORATION, SHULKER_BOX_COLORING, SMELTING_RECIPE, SMITHING_TRANSFORM, SMITHING_TRIM, SMOKING_RECIPE, STONECUTTER, SUSPICIOUS_STEW, TIPPED_ARROW
  • Constructor Summary

    Constructors
    Constructor
    Description
    GenericSerializer(Class<T> recipeClass, Supplier<net.minecraft.world.item.crafting.RecipeType<?>> recipeTypeSupplier)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    fromJson(net.minecraft.resources.ResourceLocation recipeId, com.google.gson.JsonObject json)
     
    fromJson(net.minecraft.resources.ResourceLocation recipeLoc, com.google.gson.JsonObject recipeJson, net.minecraftforge.common.crafting.conditions.ICondition.IContext context)
     
    fromNetwork(net.minecraft.resources.ResourceLocation recipeId, net.minecraft.network.FriendlyByteBuf buffer)
     
    void
    toNetwork(net.minecraft.network.FriendlyByteBuf buffer, T recipe)
     
    com.google.gson.JsonObject
    write(T recipe)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GenericSerializer

      public GenericSerializer(Class<T> recipeClass, Supplier<net.minecraft.world.item.crafting.RecipeType<?>> recipeTypeSupplier)
  • Method Details

    • fromJson

      @Nonnull public T fromJson(@Nonnull net.minecraft.resources.ResourceLocation recipeId, com.google.gson.JsonObject json)
      Specified by:
      fromJson in interface net.minecraft.world.item.crafting.RecipeSerializer<T extends SerializableRecipe>
    • fromJson

      public T fromJson(net.minecraft.resources.ResourceLocation recipeLoc, com.google.gson.JsonObject recipeJson, net.minecraftforge.common.crafting.conditions.ICondition.IContext context)
      Specified by:
      fromJson in interface net.minecraftforge.common.extensions.IForgeRecipeSerializer<T extends SerializableRecipe>
    • write

      public com.google.gson.JsonObject write(T recipe)
      Specified by:
      write in interface IRecipeSerializerReversed<T extends SerializableRecipe>
    • fromNetwork

      @ParametersAreNonnullByDefault public T fromNetwork(net.minecraft.resources.ResourceLocation recipeId, net.minecraft.network.FriendlyByteBuf buffer)
      Specified by:
      fromNetwork in interface net.minecraft.world.item.crafting.RecipeSerializer<T extends SerializableRecipe>
    • toNetwork

      @ParametersAreNonnullByDefault public void toNetwork(net.minecraft.network.FriendlyByteBuf buffer, T recipe)
      Specified by:
      toNetwork in interface net.minecraft.world.item.crafting.RecipeSerializer<T extends SerializableRecipe>