Interface IMixedIngredients
- All Superinterfaces:
Comparable<IMixedIngredients>
- All Known Implementing Classes:
MixedIngredients,MixedIngredientsAdapter
A collection of ingredient instances of different types.
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancontainsAll(IMixedIngredients that) Check if at least all ingredients from the supplied mixed ingredients are contained in this mixed ingredients.static MixedIngredientsdeserialize(net.minecraft.core.HolderLookup.Provider lookupProvider, net.minecraft.nbt.CompoundTag tag) Deserialize ingredients from NBTSet<IngredientComponent<?, ?>> default <T> TgetFirstNonEmpty(IngredientComponent<T, ?> ingredientComponent) Get the first non-empty instance of the given type.<T> List<T> getInstances(IngredientComponent<T, ?> ingredientComponent) Get the instances of a certain type.default booleanisEmpty()static net.minecraft.nbt.CompoundTagserialize(net.minecraft.core.HolderLookup.Provider lookupProvider, IMixedIngredients ingredients) Deserialize ingredients to NBT.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
getComponents
Set<IngredientComponent<?,?>> getComponents()- Returns:
- The ingredient component types.
-
getInstances
Get the instances of a certain type.- Type Parameters:
T- The instance type.- Parameters:
ingredientComponent- An ingredient component type.- Returns:
- Instances.
-
getFirstNonEmpty
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
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.
-