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.world.level.storage.ValueInput valueInput) 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 void
serialize
(net.minecraft.world.level.storage.ValueOutput valueOutput, 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 void serialize(net.minecraft.world.level.storage.ValueOutput valueOutput, IMixedIngredients ingredients) Deserialize ingredients to NBT.- Parameters:
valueOutput
- The value output.ingredients
- Ingredients.
-
deserialize
static MixedIngredients deserialize(net.minecraft.world.level.storage.ValueInput valueInput) throws IllegalArgumentException Deserialize ingredients from NBT- Parameters:
valueInput
- The value input.- Returns:
- A new mixed ingredients instance.
- Throws:
IllegalArgumentException
- If the given tag is invalid or does not contain data on the given ingredients.
-