Interface CompatRecipeDeserializer<R extends net.minecraft.world.item.crafting.Recipe<?>>

All Known Implementing Classes:
BnCFermentingRecipeDeserializer, BnCPouringRecipeDeserializer, YoukaisHomecomingSimpleFermentationRecipeDeserializer

public interface CompatRecipeDeserializer<R extends net.minecraft.world.item.crafting.Recipe<?>>
Convert Recipes added by other mods to Recipes in your own mod by emulating their Codecs and reading the JSON files as they are loaded. These should be registered to Petrolpark.COMPAT_RECIPES during mod intialization.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.resources.ResourceLocation
    createId(net.minecraft.resources.ResourceLocation baseId)
     
    com.mojang.serialization.Decoder<Optional<R>>
    Decoder that should emulate the Codec used by the other mod's Recipe Serializer.
    net.minecraft.resources.ResourceLocation
    The ID of the other mod's Recipe Serializer that this CompatRecipeDeserializer should emulate.
    default boolean
    shouldDeserialize(com.google.gson.JsonElement element, net.minecraft.resources.ResourceLocation id)
     
  • Method Details

    • serializerId

      net.minecraft.resources.ResourceLocation serializerId()
      The ID of the other mod's Recipe Serializer that this CompatRecipeDeserializer should emulate.
    • decoder

      com.mojang.serialization.Decoder<Optional<R>> decoder()
      Decoder that should emulate the Codec used by the other mod's Recipe Serializer. This Decoder should return a DataResult.error(java.util.function.Supplier<java.lang.String>, R) if there is a formatting issue with the Recipe, but a DataResult.success(R) containing an empty Optional if there is nothing unexpected with the JSON but it cannot be converted (for example, if the other mod's Recipe may optionally include Fluids but your Recipe cannot).
    • shouldDeserialize

      default boolean shouldDeserialize(com.google.gson.JsonElement element, net.minecraft.resources.ResourceLocation id)
    • createId

      net.minecraft.resources.ResourceLocation createId(net.minecraft.resources.ResourceLocation baseId)