Interface IIngredientSerializer<T,M>

Type Parameters:
T - The instance type to match.
M - The matching condition parameter.
All Known Implementing Classes:
IngredientSerializerEnergy, IngredientSerializerFluidStack, IngredientSerializerItemStack

public interface IIngredientSerializer<T,M>
An serializer for instances and condition parameters of a certain component type.
  • Method Summary

    Modifier and Type
    Method
    Description
    deserializeCondition(net.minecraft.nbt.Tag tag)
    Deserialize a match condition from NBT.
    deserializeInstance(net.minecraft.core.HolderLookup.Provider lookupProvider, net.minecraft.nbt.Tag tag)
    Deserialize an instance from NBT.
    net.minecraft.nbt.Tag
    serializeCondition(M matchCondition)
    Serialize a match condition to NBT.
    net.minecraft.nbt.Tag
    serializeInstance(net.minecraft.core.HolderLookup.Provider lookupProvider, T instance)
    Serialize an instance to NBT.
  • Method Details

    • serializeInstance

      net.minecraft.nbt.Tag serializeInstance(net.minecraft.core.HolderLookup.Provider lookupProvider, T instance)
      Serialize an instance to NBT.
      Parameters:
      lookupProvider - The holder lookup provider.
      instance - An instance.
      Returns:
      An NBT tag.
    • deserializeInstance

      T deserializeInstance(net.minecraft.core.HolderLookup.Provider lookupProvider, net.minecraft.nbt.Tag tag) throws IllegalArgumentException
      Deserialize an instance from NBT.
      Parameters:
      lookupProvider - The holder lookup provider.
      tag - An NBT tag.
      Returns:
      An instance.
      Throws:
      IllegalArgumentException - If the given tag is invalid or does not contain data on the given instance.
    • serializeCondition

      net.minecraft.nbt.Tag serializeCondition(M matchCondition)
      Serialize a match condition to NBT.
      Parameters:
      matchCondition - A match condition.
      Returns:
      An NBT tag.
    • deserializeCondition

      M deserializeCondition(net.minecraft.nbt.Tag tag) throws IllegalArgumentException
      Deserialize a match condition from NBT.
      Parameters:
      tag - An NBT tag.
      Returns:
      A match condition.
      Throws:
      IllegalArgumentException - If the given tag is invalid or does not contain data on the given match condition.