Interface IPrototypedIngredient<T,M>

Type Parameters:
T - The instance type.
M - The matching condition parameter, may be Void.
All Superinterfaces:
Comparable<IPrototypedIngredient<?,?>>
All Known Implementing Classes:
PrototypedIngredient

public interface IPrototypedIngredient<T,M> extends Comparable<IPrototypedIngredient<?,?>>
An ingredient that is identified by a given instance and can be matched with other instances under a given condition. Implementing classes should properly implement the equals and hashCode methods.
  • Method Details

    • getComponent

      IngredientComponent<T,M> getComponent()
      Returns:
      The type of ingredient component this prototype exists for.
    • getPrototype

      T getPrototype()
      Returns:
      The prototype of this ingredient.
    • getCondition

      M getCondition()
      Returns:
      The condition under which the prototype instance can be matched.
    • serialize

      static <T, M> net.minecraft.nbt.CompoundTag serialize(net.minecraft.core.HolderLookup.Provider lookupProvider, IPrototypedIngredient<T,M> prototypedIngredient)
      Deserialize an ingredient to NBT.
      Type Parameters:
      T - The instance type.
      M - The matching condition parameter, may be Void.
      Parameters:
      lookupProvider - The lookup provider.
      prototypedIngredient - Ingredient.
      Returns:
      An NBT representation of the given ingredient.
    • deserialize

      static PrototypedIngredient deserialize(net.minecraft.core.HolderLookup.Provider lookupProvider, net.minecraft.nbt.CompoundTag tag) throws IllegalArgumentException
      Deserialize an ingredient from NBT
      Parameters:
      lookupProvider - The lookup provider.
      tag - An NBT tag.
      Returns:
      A new ingredient instance.
      Throws:
      IllegalArgumentException - If the given tag is invalid or does not contain data on the given ingredient.