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 boolean
containsAll
(IMixedIngredients that) Check if at least all ingredients from the supplied mixed ingredients are contained in this mixed ingredients.static MixedIngredients
deserialize
(net.minecraft.nbt.CompoundTag tag) Deserialize ingredients from NBTSet<IngredientComponent<?,
?>> default <T> T
getFirstNonEmpty
(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 boolean
isEmpty()
static net.minecraft.nbt.CompoundTag
serialize
(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
Deserialize ingredients to NBT.- Parameters:
ingredients
- Ingredients.- Returns:
- An NBT representation of the given ingredients.
-
deserialize
static MixedIngredients deserialize(net.minecraft.nbt.CompoundTag tag) throws IllegalArgumentException Deserialize ingredients from NBT- Parameters:
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.
-