Skip to content

Serializer

class Serializer<I : ACombinedIngredient>(
    val identifier: ResourceLocation, 
    factory: Function<List<Ingredient>, I>, 
    allowEmptyCodec: MapCodec<I>, 
    disallowEmptyCodec: MapCodec<I>
) : IACustomIngredientSerializer<I> 

Constructors

Serializer

constructor(
    identifier: ResourceLocation, 
    factory: Function<List<Ingredient>, I>, 
    allowEmptyCodec: MapCodec<I>, 
    disallowEmptyCodec: MapCodec<I>
)

Properties

identifier

open override val identifier: ResourceLocation

{@return the identifier of this serializer}.

packetCodec

open override val packetCodec: StreamCodec<RegistryFriendlyByteBuf, I>

Functions

getCodec

open override fun getCodec(allowEmpty: Boolean): MapCodec<I>

{@return the codec}.

Codecs are used to read the ingredient from the recipe JSON files.

See also

  • Ingredient.CODEC
  • Ingredient.CODEC_NONEMPTY