Interface IMixedIngredients

All Superinterfaces:
Comparable<IMixedIngredients>
All Known Implementing Classes:
MixedIngredients, MixedIngredientsAdapter

public interface IMixedIngredients extends Comparable<IMixedIngredients>
A collection of ingredient instances of different types.
  • Method Details

    • getComponents

      Set<IngredientComponent<?,?>> getComponents()
      Returns:
      The ingredient component types.
    • getInstances

      <T> List<T> getInstances(IngredientComponent<T,?> ingredientComponent)
      Get the instances of a certain type.
      Type Parameters:
      T - The instance type.
      Parameters:
      ingredientComponent - An ingredient component type.
      Returns:
      Instances.
    • getFirstNonEmpty

      default <T> T getFirstNonEmpty(IngredientComponent<T,?> ingredientComponent)
      Get the first non-empty instance of the given type.
      Type Parameters:
      T - The instance type.
      Parameters:
      ingredientComponent - An ingredient component type.
      Returns:
      The first non-empty instance, or the empty instance if none could be found.
    • containsAll

      default boolean containsAll(IMixedIngredients that)
      Check if at least all ingredients from the supplied mixed ingredients are contained in this mixed ingredients. This mixed ingredients could contain more ingredients.
      Parameters:
      that - The ingredients to look for.
      Returns:
      If at least all ingredients in that are contained in this.
    • isEmpty

      default boolean isEmpty()
      Returns:
      If at least one non-empty ingredient is present.
    • serialize

      static net.minecraft.nbt.CompoundTag serialize(net.minecraft.core.HolderLookup.Provider lookupProvider, IMixedIngredients ingredients)
      Deserialize ingredients to NBT.
      Parameters:
      lookupProvider - The lookup provider.
      ingredients - Ingredients.
      Returns:
      An NBT representation of the given ingredients.
    • deserialize

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