ACombinedIngredient¶
abstract class ACombinedIngredient : IACustomIngredient
Base class for IACustomIngredients that combine multiple sub-ingredients, e.g. AAllIngredient (matches when every sub-ingredient matches) and AAnyIngredient (matches when any does).
Inheritors¶
Types¶
Serializer¶
class Serializer<I : ACombinedIngredient>(
val identifier: ResourceLocation,
factory: Function<List<Ingredient>, I>,
allowEmptyCodec: MapCodec<I>,
disallowEmptyCodec: MapCodec<I>
) : IACustomIngredientSerializer<I>
Generic IACustomIngredientSerializer for ACombinedIngredient subtypes, built from a factory and empty/non-empty codecs.
Properties¶
ingredients¶
val ingredients: List<Ingredient>
The sub-ingredients being combined; always non-empty.
matchingStacks¶
abstract val matchingStacks: MutableList<ItemStack>
The stacks that match this ingredient, for display purposes (e.g. in a recipe viewer).
Guidelines for good compatibility:
-
These stacks need not be exhaustive or perfectly accurate, except when
requiresTestingisfalse, in which case they must correspond exactly to every accepted item. -
At least one stack must be returned, or the ingredient is considered empty.
-
Try to include at least one stack per accepted item, so inspecting mods can enumerate what the ingredient might accept.
No caching is required here; the ingredient itself already caches this.
requiresTesting¶
open override val requiresTesting: Boolean
true if any sub-ingredient is a custom ingredient that itself requires testing.
serializer¶
abstract val serializer: IACustomIngredientSerializer<*>
The serializer for this ingredient. Must have been registered via IACustomIngredientSerializer.register.
vanilla¶
@get:
ApiStatus.NonExtendable
open val vanilla: Ingredient
Converts this custom ingredient into a vanilla Ingredient behaving the same way.